As someone who moved out of a city I think I can speak from first-hand experience. Of all the neighborhood kids I grew up with the one's with blue-collar jobs are still living there. They never made enough money to leave. They are either living in the same home they grew up in (which their parents purchased) or are renting. Some of these people purchased nearby property by leveraging the money they saved by living at home and became landlords (renters pay much of the property costs). However those who got successful white collar jobs fled the city. They purchased a home in the more well-to-do suburbs where the median income is higher than the typical city dweller. They have larger acreage and can put in a pool, park a boat, have a large private playground (with slides, swing sets, inflatable bouncers, etc) for their kids (instead of them running off to a park), grow fruit trees, large vegetable and flower gardens, greenhouses, etc. They are also surrounded by higher income people so their neighborhoods are generally nicer looking and clean. When their parents die and their old city home becomes available they never move back to city life. They either sell it (usually to a landlord) or become landlords themselves. None of my siblings wants to live in our parents' home even though it is over 6,000 sq feet (557sq m), worth well over $1M, and has main bus lines stopping within 250m of the door.
Many white collar companies also moved closer to the suburbs (for instance many high tech companies are in the 'burbs). So people now have the choice of working in suburban locations or commuting into the city (or even remote desktop). I happen to work for a large financial company with offices in both areas. I worked in both. I'm currently in one of their main downtown offices. There's well over 1000 people across multiple offices (some overseas) and pretty much everybody makes 6+ figure salaries. I do not know of any co-worker who has their primary residence in the city (they may have a secondary or a third). It certainly isn't because they can't afford it.
Costs in the suburbs are not necessarily cheaper than the city. Many people in a nice suburb pay over $10,000 just in local property taxes a year. That's a showstopper right there for many people who want to leave the city and are used to paying maybe $2K. Only a crappy town in the middle of nowhere would be that low. So if people don't make good money they are stuck in the city or forced to rent in a suburb (if it has apartments) or buy a place in the middle of nowhere.
That isn't to say there are no well-off people living in the city...of course there are.