Do you know how the Enterprise is this huge ship that carries a huge population, but yet very few people are seen working in each department? Yeah, the rest of them just stay in their bunks doomscrolling, subsisting on Doritos and soda from the replicator ("Diet Coke, cold"). A significant part of government provided basic housing is on starships, because it gives their working crews a sense of importance. When a ship is in range of other ships, space stations, or planets, transporter technology is used to seamlessly reallocate the population. The residents would notice if they bothered to look out their windows, but they mostly don't. It's also why the rest of the ship is so austere - the working crew knows that indulging base material desires is the fast track to becoming a bunk dweller.