Must be something to do with spawning in a safe place or something, but yeah if the previous location was deemed to be unsafe you usually end up at ground level.
It wasn't doing it when I set home to an underground position, only when I warped back from death or jumping to the spawn. I'm not sure if it does it every time or not.