But it's not sea level either, my understanding is that the reason why most ancient capitals are built inland is military.
Coastal areas are harder to defend from foreign invasions than inland areas, as there is little signal and time to mobilize troops, moreover, martial strategy privileges high ground.
Capitals were usually built around a river that connects to the sea, and where that river meets the sea, you can usually find a fortified town which had a military garrison.
My guess is that the advent of the airplane bomber has changed the considerations.