That's why we draw a distinction between following the letter of the law and the spirit of the law. Or, as the dude put it, "you're not wrong Walter, you're just an asshole."
Apple's tax structure rightly prompted outrage, and Ireland was shamed into closing the loophole: http://www.bbc.co.uk/news/business-24542794