Because a rational labor market participant would consider that $1 purchasing power in SF <> $1 purchasing power in [Any other city / state].
Hypothetically if you were planning this as Google you wouldn't make the 1-1 scaling of lower salaries, but if you as employee would pay 80% less rent, could buy a massive home after working for <1 year, and still have more left over than you would ever have working in the bay, the trade-off would at least look somewhat appealing.