Directors are under a fiduciary duty to make decisions they feel are best for the company and its shareholders. That's does not mean they have to do every legal thing to make more money. There are several things that may make money in the short term that are not in Google's overall interest in the long term. Imagine if they suddenly added 1000% more ads to Gmail, for example. The monetary gain would not be worth losing the users and their good will.
Now, I would hope that use of tax havens, selling user data, etc fall into that same category, but clearly the math is different when we are talking about billions of dollars.