We have a global economy but not a global tax system or a global set of rules. That's the essence of the issue here I think.
What also happens is countries upping one another with lower taxes and exceptions to attract big companies hoping to get some (small) benefit from it.