Granted, companies work hard to be devious. But when we allow them to spend their profits on a whole slew of stuff that reduces their tax rates to zero percent, it seems churlish to blame the companies. Government specifically waived taxes in order to encourage e.g. R&D and now we, the people, are paying the price of the details of a large raft of this sort of law making.
Governments also use tax law to reward specific groups of people, for reasons both honorable and nefarious.
Identifying the motives for a given tax law is often quite difficult. Companies currently get to avoid most taxes on profits that are reinvested in activities that they certify as "research and developement". Is this possible because the government wants to encourage R&D or as a payoff to their political sponsors, or both?
It's non-trivial to answer, but what's easy to say with certainty is that is an example of _how_ companies avoid paying taxes, and if you want to stop it, you need new tax laws which don't permit/encourage this.
NOT A SINGLE WEALTHY PERSON has done this. None. Zero. Nada.
There's your answer as to the priorities of capitalism.