All cities need janitors, teachers, baristas, grocery clerks, garbage collectors, etc. in order to function, and those people have to live somewhere at least within a reasonable commuting distance to the city. You can't have all the garbage collectors move out to Bakersfield and have San Francisco _just_ be a citadel of software engineers, unless the software engineers haul their own garbage, or the garbage collectors in SF also get paid $100k+ per year.