In many cases the company might have a subsidiary in a lower cost of living location (India, Eastern Europe, etc). The company I work for has slowly been laying off software engineers, project managers, and technical support folks in the US, while simultaneously hiring their replacements in those LCOL areas. I get to see the cost rates for these folks, and it is pennies on the dollar :(
There's always a tradeoff, sometimes you win sometimes you lose in these gambits.
It's a temporary strategy. Chinese factory workers and Indian workers know they're being underpaid and gradually get paid more and more. This offsets the cost savings and makes logistics and managerial barriers more glaring.
If you're a hotshot Serbian developer making a two thirds of an American, you're going to look for ways to reduce that delta.