If so the only part of the comment you were replying to above that was "overturned" was the word "illegal". Just wanted to make that clear, since I'm one of the people who think that it's still immoral and should be illegal.
Well in a court of law, it is the letter of the law that matters, not how we feel. So it may be immoral but is not illegal.
Some countries including France and Germany have the concept of "Abuse of Rights" [0]. I don't know if it would apply in a case similar to Apple, but it can definitely apply when you're trying to find loopholes to not pay taxes.