Here in NZ, any arrangement which does not have a clear purpose other than tax reduction, is a sham and is illegal.
It seems highly unlikely that these arrangements really are legal, if closely examined. Just that hitherto it hasn't been worth picking apart, especially as most of the liable players are off shore.
By keeping the financial transactions booked in tax havens like Singapore, they are deliberately making it difficult to prove the illegal actions in court. All critical documents such as emails etc that are germane to the conspiracy to commit tax crime are protected by the fairly draconian and uncooperative secrecy laws that Singapore and similar countries provide for their clients.
By analogy, drug kingpins can claim that what they do is legal, as long as critical evidence remains hidden.
This of course is not true.
All the Australian banks in NZ ran a multi billion dollar tax scam, that they also claimed was totally legal etc etc. In this case IRD got over $2B (thats about $1000 for every taxpayer in NZ)
http://www.interest.co.nz/news/50203/overseas-firms-offer-settle-retrospective-tax-avoidance-dispute-ird
http://www.nbr.co.nz/article/bnz-pay-ird-654-million-105685
Of course in this case IRD could get access to the documents.
Eventually it gets so outrageous and egregious that Inland Revenue sees there is enough money to be gained to make it worth trying to enforce the law.
Once you start avoiding more than $500M of tax, it becomes worthwhile to invest $50M on a 5 year long prosecution effort to collect it.
Tech companies have now reached that point:
IRD knows they are breaking the law. The Politicians know they are breaking the law. They are now building public opinion to support prosecutions which will be very expensive.
Go IRD.
Go Pollies! (did I just say that???)