Note that "work" in a physics sense doesn't mean the same as "effort" in a human sense. For example, if you hold a weight in one position in mid-air (you're a weightlifter), you would certainly think "work" is being done just holding it there, but in physics terms no work is being done in holding the weight itself in mid-air. (Although certainly there is work being done, maintaining the static position of the weight isn't "work" per se).
That's relevant to your second example, where the answer is along the lines that it's in equilibrium (balance) with gravity, not "fighting" gravity.
The system as a whole - that's the earth, the magnet, whatever the magnet is being repelled by, whatever's supporting that against gravity, and all of their related forces - is seeking the lowest overall (potential) energy level it can reach, which happens to be one where the magnet is in mid-air, so that's where it ends up and stays, until something changes.