There are laws in place in Canada and Mexico setting the prices. As long as the drug doesn't cost more to manufacture than the pharma earns selling it, they will accept those price controls and pass all of the R&D costs on to the U.S. market. That's business. But if the U.S. tries to impose he same costs, there will no money to be made developing new drugs (and a lot to be lost). The industry will all but disappear.
It's got nothing to do with being nice or fair. It's simply business.