The command works as it should - note that the ; starts a new command altogether, so what you’re doing there is
sudo dnf clean all [succeeds because you are root]
dnf clean all [fails because you aren’t root]
dnf repolist [succeeds because it doesn’t need root]
dnf --refresh upgrade [fails because you aren’t root]
what you want to do is either
sudo dnf clean all; sudo dnf repolist; sudo dnf --refresh upgrade
or
sudo bash -c "dnf clean all; dnf repolist; dnf --refresh upgrade"