You're exactly right. While we look at this stuff as despicable, because it really is, we can't blame the companies. Except ... we can, right? They're the ones who have manipulated the tax codes, right? They're practically writing the laws, right? Ultimately though, the politicians are the ones who are passing the laws. They're the ones who are being bribed, excuse me, funded, by corporations and the wealthy. To blame corporations for taking every advantage of the system, to manipulate it in whatever way possible, is silly. Capitalism rewards innovation. It rewards plugging the holes that cost money (and taxes can be quite a big hole). These can be great benefits to everyone to some extent, but they also eventually lead to buying out competitors which reduces competition, which can result in big, lazy companies who'd rather legislate than innovate - I'm looking at you, Cable Company and Telephone Company, or the Media conglomerates. That's what we have the world over.
Maybe it's just me, but for me, the problem is our political system - it's not designed to withstand these corrupting forces. Some countries deal with it slightly better, but barely just.
I like competitive capitalism. I like democracy, and even the idea of a representative democracy. But they don't play well together when you have the capitalists ultimately deciding who gets to represent the people, and then those representatives bending in every which way to make things easier for their funders. When you have a system that rewards bribery, or has in its place a revolving door between legislators and business, you're going to have these effects. The solution to this I think is really rather simple, but I'll leave it as an exercise to the reader.