The scheme was essentially like this:
- Apple Ireland bought iphones for 200$ or so (talking about pre X numbers, now they're likely slightly higher)
- Apple Ireland sold iPhones to Apple Italy for 599€s
- Apple Italy sold iPhones for 599€s + vat (thus avoiding to pay any corporate taxes in Italy while making billions)
- Apple Ireland had a special agreement with Irish tax so they paid like sub 1% corporate taxes on the 400€s of profit
This way not only Apple wasn't paying any tax in the countries they were doing business with, but also paying extremely low taxes in Ireland.
On top of that, which isn't illegal per se, it happened allegedly on top of preferential treatments (but I'm not much informed on the details here).