US companies do have to pay taxes on overseas profits, which is why they so often have subsidiaries based overseas. Those entities do not have to pay those taxes.
A regular US person gets a US tax credit for taxes paid to foreign governments. But if that's less than they would've paid to Uncle Sam, they still have to pay the difference here.
That's not true for these overseas subsidiaries. That, as you said, is a major reason these subsidiaries even exist (I'm sure local laws also require them in many cases, but still).
And their existence guarantees that tax burden will be optimized globally, rather than locally - the nontrivial price of setting up and running a subsidiary has been paid, so of course it will be used to get benefits as well.