Well, ultimately a 'Mech will do a better job than a tank with roughly comparable firepower, in-universe. That's kind of the basic point of having them in the first place.
The "too expensive" argument...tends to fail to convince me if examined closely enough, to be honest. By the actual C-bill values, tanks are arguably not cheap enough by comparison to justify their continued existence centuries after the BattleMech should by rights long have ursurped their tactical niche. It's a bit like arguing that prop fighters should still be everywhere in the modern-day skies because jets are so much more complex and expensive, really.
On the meta-level, though, I do believe I understand why tanks are still around in the fictional 31st century of BattleTech. It's because what we're talking about here is ultimately just a war game for 21st-century nerds who still believe that tanks are somehow cool, not a genuine historical simulation, and also because you couldn't very well show off the superiority of 'Mechs if there were no tanks around to compare them to anymore. If TPTB hadn't given us canon MBTs early on, you'd better believe that we'd just house rule them in in some way or other.
And it's on that level, once I stop trying to make in-universe sense of their ongoing presence, that tanks start to click for me. ;)