Because, well....
..it's magic.
Spells that are dependent on environmental conditions typically call them out - Call Lightning springs to mind as a good example.
Now, if you really want something to consider -- Meteor Swarm targets four points, designated by the caster. So it should be possible to cast it 'up' at a ceiling, or down a corridor... or at a wall, right? Meteor Swarm creates four lots of a 40' radius spheres wherever the caster can see within its range, the caster could conceivably target the ceiling, the wall, the floor and the back of a wandering ogre's head. Underground or otherwise.
ncG1vNJzZmivp6x7prrWqKmlnF6kv6h706GpnpmUqHy4tMCtZKGZoKWyr7%2BMop1msZ%2BqeqSt0q1kpp2kmryzedKwmKulXaq7pbHRoKmorZ6ZerC%2BjKKlnaefp8BvgpBrbm5tXw%3D%3D