That's basically it. They are trying to get some tax exemption. And its not only Apple (Google or Amazon are in the exact same position).
My suspicion is that the current "we will manufacture in the US" has to do something with it (Both Google and Apple have announced plans for this), probably some kind of agreement in Washington about capital expenditures being exempt for taxes.
I don't think this is poor planning. International sales grew fest and they found themselves in this situation. If you ask in any other country (esp. in Europe) they'll probably tell you that that money shouldn't be taxed in the US as it was made by selling products on local markets and siphoned away using financial tactics that are frowned upon (selling straight from Ireland, usually).