In your 150k example you're using 1/3rd of your salary just for rent (assuming you get 150k, net).
[1] https://www.rentcafe.com/average-rent-market-trends/us/ca/sa...
That's a saving of $30k/year, or maybe $40k/year before tax.
From what I understand from reading comments here, salaries in places with lower cost of living are not just $40k/year less, but much much less.
And for those earning more than $150k, the math works out even more in favour of the Bay Area, as the % drop in salary goes up with salary, whereas the $40k rent difference doesn't.
If you don't mind living in a rented room or commuting >1hr a day and shop exclusively at amazon and costco, the bay area is a great opportunity to save money.
If you're a software your aim is to buy a decent home in $US_CITY at some point, the easiest way to come up with large downpayment is to work in the Bay Area for a few years. You don't have to live in the Bay Area forever.
https://sfbay.craigslist.org/pen/apa/d/old-mountain-view/667...
https://sfbay.craigslist.org/pen/apa/d/pet-friendly-house-nr...
Sounds good enough to start a family to me.
And of course, once you become a little bit more senior and your salary goes over $200K, you won't mind spending so much on rent and will start saving significantly more than elsewhere.
It's possible that there is a natural filter in play here, with the people whose salary is not increasing significantly basically forced to leave.
But that's the point: the difference in rent is much smaller than the difference in market salaries.
"Your whole paycheck goes to the landlord."
If you're an engineer with a $150k salary, which is at the low end for most companies you've heard of that have offices in the Bay Area, then it's very unlikely you spend anything close to your whole paycheck on rent.