Tax law is gamed, apple is no better here than all the rest. It's not an excuse, but Apple is one part of a overall problem.
While there's much more apple can do as a corporate citizen the App Store alone has done more good for society and wealth creation than anything else we've seen as of recent time. You can throw in the smartphone boom and the expansion of mobile consumerism helping all sorts of new business models grow or take off in retail/travel/entertainment by putting a computing device on everyone.
Also, simplifying apple to they just got lucky with the iPhone forgets all the success in relative terms of the iMac and relaunching the computer business for apple. iPod and iTunes. It's been an evolution, one many of the tradional Apple competitors missed completely and spent years trying to replicate (hp, dell, acer, ms, nokia not to mention all the defunct hardware/service companies that fell to newer tech).
Boiling it down to one key product can be said of any sucsessful company. MS wouldn't even be here if it weren't for Windows. Google wasn't guaranteed the search win. Facebook with MySpaces death etc.