I’m not arguing that one should expect the same pay everywhere. It’s simply my observation America typically pays engineers well, and much more than the two countries I cited in typical software company roles.
In the countries I have direct experience of, I would however argue the pay differential can be significant beyond just cost of living adjustments though.
From what I know, American based tech companies pay good salaries in countries like India as well. These are of course adjusted to cost of living, which is significantly lower. I don't think it's realistic to be working in a tech company in India and expecting silicon valley salary but the salaries people usually get is generally good enough for that region.