It's literally cheaper for Apple to store the cash outside the US and then get loans for the money they can't bring into the country.
That's just wacky. For a country that is incredibly pro-business and pro-corporate the USA is very strange on this front.
Part of this I think may actually be intentional, to prevent the accidental creation of technically-legal-but-obviously-exploitative loophole tax strategies. If it's fuzzy, you have to weight your risk of audit, your ability to justify your choice, and so on.
Anyway, in the corporate case there are also fundamentally difficult-to-define areas. For example:
Company A transfers its global IP portfolio to Subsidiary B. B is incorporated in Ireland, but is controlled and managed by directors based in a low corporate tax jurisdiction such as Bermuda, the Cayman Islands or Andorra; crucially, under Irish law, this characteristic renders B tax resident in these havens and therefore subject to their relevant tax legislation. Subsequently, B grants licences to exploit the IP portfolio to Subsidiary C which is incorporated and tax resident in Ireland; it is this link between two Irish subsidiaries which yielded the name “Double Irish”. C is the actual operative unit of the Company A: it owns real estate, it employs workers, it exploits the IP portfolio, it sells advertising and collects payments, ultimately generating earnings. Nevertheless, C does not make profits, as it has to pay royalties to B for the IP licences; crucially, B pays very little corporate taxes because it is based in a tax haven. Thus this structure allows A to shift all profits emerging from its IP portfolio to a jurisdiction where they will not be subject to a significant rate of taxation.
This scheme depends in part upon the ability of the company to set royalties and IP transfer costs at whatever they like, independent of the real value of the IP. Clearly this is not quite right, but what is the real value? Who determines it?
For example, what if they said that the taxable location of the entity was a function of the output of a quantum state? This is a grey area, but is even this enough for us to say that they are clearly just trying to pull the wool over the governments eye?
How could that be the basis for an intelligent taxation system?
What if the literal interpretation create unfair loopholes?
Then you change the law.
Specific laws don't preclude the ability to use common sense and judgement, and the law shouldn't be expected to explicate every possible permutation in order to be enforceable.