You get a discount for age (younger = cheaper; flattens out after 5-10 years), experience (probably why age is discounted), and things that are not politically correct to talk about but are very real effects affecting the labour market.
Maybe my experience was biased by hiring for relatively specialist skills (Haskell, dev ops) which may make for more meritocratic markets.
Also, due to enormous cost of living and tax differences (~0 income tax in Ukraine) the same gross pay resulted in 2-3x times higher disposable income, so effectively the Americans were relatively underpaid, which is kind of funny.
The thing is, there's no such thing as an "average" developer. Every company and its tech stack has a unique set of conditions that will match better with some people than others. If your codebase is bog standard [insert popular framework], someone who has done it 4 times before, but couldn't make a relational schema because he doesn't know what an SQL constraint is and thinks functional programming is "academic ivory tower stuff" is going to be a lot more value adding upfront than someone with a PhD in category theory and 5 years AI experience; but the latter is the person you want building your search algorithm or trading technology.
And then, as with academia, you have non-financial compensation; for example, we got a lot of people interested by offering Haskell jobs which are very rare today (at least in stable places); remote work was another plus, as many people have a comfortable situation and don't want to uproot their life for the sake of a new opportunity, and it allows people to arbitrage cost of living differences between cities. But Scala didn't work out for LinkedIn, which is rewriting all of it back to Java, and remote work didn't work out for Yahoo, so YMMV.
Why is their work deemed $30/hr where as a Western counterpart could get away with charging $90? Same goes for people in India as well - if they are genuinely good at what they do why do they not charge a higher rate?
If they try to start out on their own, they start with low confidence, which means low prices. Which leads to people thinking they aren't capable of anything complicated, so they get only shitty jobs. Which reinforces their low confidence in their skills and they don't try much.
Steve Jobs of the world will always earn more than Wozniaks.
Which leads to the fact that you can hire a BS educated employee in those country for less than $200-300/months: if the programmer charge more, they're just gonna screw automation and hire more people instead.
The demand for these services mostly comes from the West, and there is a big advantage to local workers. So assuming there is a large supply of skilled data scientists in India and Ukraine, but not the demand, then they can't charge higher wages.
Furthermore, if these barriers could be broken down, and there was no longer an advantage to being local, then we would expect the price of Western and other workers to equalize, but the final wage would be somewhere in between the current Indian wage and the current Western wage.