You aren't actually paid based on cost of living, per se, but as that factors in so heavily, it can swing the value proportionally.
If I move back to Memphis, TN, I can make approximately half of what I make now in the DC area to live as comfortably as I do. Does that mean I'm worth half as much? No. Does it mean I should expect to make half as much? Pretty much, yeah.
Beyond meeting my basic needs (rent, food, whatever) then it's just a matter of how much expendable income does that salary leave me. I don't know if 'percentage of salary' is the best way to measure it, but it factors in.
Paying me 'market rate' in a place where a 3 bedroom 3 bath house can be had for $150k is a vastly different proposal when that same house is $450k in a different place. That is the 'cost-of-living' difference. Sure, I might add the same x amount of dollars of value to the company in both locations, but if I can't live comfortably in my market, then it doesn't matter.
Note, this argument ignores the competitiveness of the markets as well. There are naturally more potential developers in silicon valley than there are in Bumfuck, Nowhere. Supply and demand does factor here.
Lastly, except in situations of outsourcing, you're generally not paid based on where YOU are, but based on where the company (or the location you report to) is. If you're working remotely from Timbuktu while reporting to an office in Silicon Valley, you should expect SV (or near-to) rates. If you're telecommuting to the midwest, you should expect midwest pay.
The big difference there is in what it costs to replace you. If you're Linus Torvalds, that cost probably goes way up. If you're like most of us, that cost is probably a close approximation to 'whatever they can hire a local developer for', assuming there are local developers in the area with the skills you possess.