Companies don't do this. They will adjust your salary down based on your city of residence. Square is one example of this. You're not compensated for the value you provide, you're compensated for the cost of living near the office.
You're also now competing against a national talent pool vs locals only
Some do. I've gotten this deal in the past personally and know others that have as well. Always for employees with tenure that they want to keep around.
Remote salaries in tech are typically well-above "local" rates, either way.
If you want to hire A, you have to compete with local SF company that pay high wages.
If you want to hire B, you have to compete with local small town companies which pay low wages, plus a very small number of remote companies which are in the same position as you from a game-theoretical perspective.
I think it's obvious that in the long term, if remote work becomes widespread, wages (and thus cost of living) will level out, but in the short term if few enough companies do it they can beat the prisoner's dilemma and keep remote wages lower than the ones in Silicon Valley.
You're also now competing against a national talent pool vs locals only