Sorry, I was not clear: I think if you have the option to work in Silicon Valley, you can make more elsewhere.
The housing crisis and (to a much lesser extent) generally high wages amplify this imbalance.
Lots of people say that Silicon Valley pays particularly well, and I think this is true only statistically. Silicon Valley pays world-class engineers more than Chicago pays mediocre engineers. I believe a world-class engineer is likely to make more in Chicago than in Silicon Valley, provided that the engineer can find a suitable job at all in Chicago.
So if want to maximize expected income, I think you should live in NYC working in finance, or if you don't like that option, anywhere in the U.S. except the Bay Area. I don't know anything about the rest of the world so I wouldn't give any advice about that.
If you want to maximize the likelihood that you can find an interesting job in software, you should move to the Bay Area.