Rational != Ethical
Rational != Ethical
A business can't tell their landlord that they owe no rent because they are "unprofitable" ? Why then do we accept this excuse from the businesses who benefit the most from our public systems.
The reason politics is full of vapid stupidity is that powerful entities want it that way. If the population wasn't distracted by guns, abortion, and gay sex they might actually be paying attention to issues that matter.
First, the legislature often decides that raising or lowering specific taxes is a good way to encourage some behavior or other (i.e. mortgage tax deductions or extra taxes on cigarettes). Most of these are actually pretty justifiable individually, but eventually you end up with too many exceptions and special cases for any nonspecialist to keep them all in their head.
Second, there's a huge body of caselaw and regulatory rulings that crop up around the actual tax code. Dozens of courts somewhat haphazardly decide that this weird edge case counts as income, but that weird case doesn't. Again, almost all of these are pretty reasonable taken in isolation, but you end up with a swiss cheese of arbitrary and contradictory rules.
Finally, wealthy entities will inevitably try to game the system. They will try to find a few well-intentioned but poorly thought out edge cases and alter their finances to try and intentionally fit a huge percentage of their income into them. By the time this happens, it's often very difficult to fix without hurting the innocent bystanders that the edge cases were put in place for in the first place.
Wealthy individuals and companies do lobby for favorable tax provisions, and politicians do sometimes pass laws specifically to benefit those entities. But the reality isn't that simple. International tax law is an emergent phenomenon, and it's really only going to bend to systemic incentive changes.
We do? Why? Because, by one interpretation, they pay lip service to it by saying "Don't be evil"/"Do the right thing"? I take those as marketing (both to the public and to their employees).
Even if we take their mottos as honest statements of intent, how do you know that their definitions of "evil" and "right" match yours? Or that their definitions won't shift to fit the situation?
If they are amoral entity, I'm sure they won't care for Spanish government doing unethical but not illegal things to them as well.
Why would that be true? It would be inconsistent for them not to fight for their own self-interest. Also: Governments must be held to higher standards than corporations.
I expect the Spanish government to act (nominally) in the best interests of its citizens. I expect Google to act in its own best interests.
It's fine to take a modern, legalistic, maximize-shareholder-value-or-gtfo approach and eschew the ethics and spirit of law perspective altogether. However, generally it would be irrational for corporation to expect a favourable outcome in a survivalist game on a legal field against the host government. That's why most corporations at least do lip service to ethics, community values, social responsibility and so on. Which leads us to square one.