I won't disagree that companies are only doing what's permissible. And rest assured I place the blame squarely on politicians. (And you better believe these things do influence my vote.)
But in many tech cases the IP is created in Silicon Valley (using American infrastructure, emergency services, etc), it resides in Ireland, and is financially offset by everyone else. So Americans could argue they are owed a little more in tax.
Again, I blame politicians. I know they leave these loopholes open deliberately -- they're remarkably efficient at passing legislation when they wish. (Violating our privacy, extending their entitlements, closing tax loopholes for private citizens, etc.) I presume they turn a blind eye to mega corporations for one or both of the following reasons: (1) political donation largesse; (2) a board seat when they leave politics.
On the upside: tracking the rise of minor parties and independents in Australian politics over the past decade -- including the occasional hung parliament -- gives me hope that democracy might just be working. (Albeit slowly.) And I don't think the future is great for the major parties