The rest of the world has governments that negotiate directly the Pharma companies and strike up deals that subsidize the first X doses per year per Y number of people. Once the limit is passed it's the same for everyone - pay the price or find an alternative. NB that this doesn't happen only with US companies, e.g. Roche is very profitable selling Million-dollar-per-course cancer treatments.
But in general, the fact that Pharma companies can sell at "full price" in the US subsidizes the drugs for the rest of the world.