Magnetic force scales as 1/r^3, not 1/r^2 like gravity. That's why your standard issue fridge magnet measurably attracts stuff only from a very close distance, but when it does, it easily counters the gravitational attraction of the entire planet¹. This 1/r^3 relationship can be derived easily enough by integrating, but essentially it's because magnets are dipoles and the farther away you are, the smaller the apparent distance between the poles and the "more neutral" the magnet looks like.
Anyway, that's why there's an equilibrium distance where the forces balance. But superconductors also exhibit a very strange phenomenon called flux pinning [1] where a levitating object is held in place by magnetic field lines and you can even turn the whole thing upside down and it still levitates even though the forces don't cancel each other out anymore!
[1] https://en.wikipedia.org/wiki/Flux_pinning
---
¹ To be fair, "the entire planet" is also around 6000 km away, calculation-wise, but still!