Why software engineers should start their careers in San Francisco
qz.com
qz.com
Simply put, as you grow in your career and can provably add more value than you cost, you gain more leverage in salary negotiation (typically). So if you ratchet up to a high salary in SF, you might have to take a dip when moving to lower cost of living areas, but perhaps not. Maybe you just take less of a pay increase. Either way you'll likely still come out much further ahead.
If you can manage to budget effectively and can save/invest smartly, those dollars you initially earned in SF can go much further elsewhere.
Don't get me wrong, I absolutely love living in the Bay, but I'll admit I've been very tempted to move somewhere with a lower cost of living where my money goes a lot further. Of course the tradeoff is I likely wouldn't have the amazing weather, people, food, activities, culture, etc. that exists here in such a rare combination.