system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How come battleships are obsolete but tanks are not?

A tank seems basically like a battleship on the ground.  What differences are there between naval warfare and ground warfare that have kept the tank viable in modern war?
gpt
It's all about range and the ability to attack at range.

In WWII, when battleships were still being used in significant numbers, the upper limit of your ability to attack the enemy was limited by your ability to visually see the target. That visual limit was the curvature of the earth (since oceans are relative 'flat' surface). A battleship could only reliably attack what it could visually see. And given that boats were big, relatively slow moving things, you wanted to know where your enemies were so you could begin moving towards them. Recon planes aided battleships to an extent, but it did not drastically increase their ability to hit targets at extreme ranges. Even the advent of radar did not help battleships because the curvature of the earth still inhibits their ability to see.

Enter the aircraft carrier - a ship capable of launching attack planes that could not only go beyond the curvature of the planet, but attack targets as well. All of a sudden, you have a ship capable of spotting and destroying targets beyond visual range in a reliable fashion. This is a huge advantage in naval warfare because, unlike in ground combat, you have no cover - you're best means of defense is keeping as much distance between you and your opponent as possible. The ability to attack targets that are incapable of retaliating against your ships is a massive advantage.

And since boats are, again, slow moving things, a battleship has no real means to engage an aircraft carrier. It cannot 'surprise' one because it will be seen coming from miles away by the planes. If a battleship could suddenly plop itself within gun range of an aircraft carrier, it would be a no-contest for the battleship to win. But that will never be the case, and thus the battleship fell into obsolescence. Cost of building/maintaining only entered into the equation in the sense that you don't spend money on things that aren't useful; and battleships simply weren't useful anymore in naval warfare.

Ground combat, however, is a much different story than naval warfare. You might have guns that let you shoot as far as your eyes can see, but there might be hills, mountains, and buildings in the way. The terrain obstructs your ability to see enemies, and thus your ability to keep them at a distance. As a result, you cannot necessarily rely on weapons that have limited defenses in close-ranges because you have less effective control over your ability to keep distance. But when those distances can be maintained, you do see extensive use of these long-range tools - artillery cannons and airstrips allow one to, again, engage at long range with limited enemy ability to retaliate. And air support is becoming an increasingly larger facet of ground wars.

But dense terrain, particularly urban environments, necessitate the need for an armoured vehicle that can exert great power and survive retaliation from enemies at close quarters. You can bombard a city to rubble, but in the end you'll still need to send in the army to clear the city out, and they'll need the armour support to maintain a tactical advantage over enemies.