I harp on this constantly. But housing is not more expensive in the majority of American metros. Adjusted for inflation the median cost per square foot of new housing is almost exactly the same as it was in 1990. (This doesn't even take into account that mortgage rates are drastically lower since then.)
We get skewed on this for two reasons. One is because homes today are substantially larger and have more amenities than they did in previous generations. We take for granted better fire safety, higher ceilings, central A/C, higher load electrical circuits, attached garages, better lighting, and swimming pools that are much more common in new construction.
Two is that we're highly skewed to a handful of elite metros, whose housing markets are not representative of the country as a whole. Housing is expensive in San Francisco, New York, LA, and DC. But in places like Tampa, Omaha, Cincinnati, and Phoenix the cost of housing (per square foot) has barely gone up at all.
The demand for ultra-expensive housing in places like the Bay Area is driven by the huge earning potential of the high-skilled labor market. (Of course the supply side of the equation is driven by NIMBY zealotry.) If you're talented enough to make it as an L8 at Google, then it probably does make sense to buy a house in Palo Alto. You'll earn far more money than you would in the St Louis tech scene. more than enough to make up for the living costs.
But unless you have the potential to become an L8 at Google (or equivalent), it makes no financial sense to choose to live in the Bay Area instead of Raleigh. It's like somebody who works as a back office bookkeeper insisting on buying custom tailored Seville Row suits for his work attire, then complaining that the costs of clothes has gotten out of hand.