Wrong under EU tax law a company registered in the EU only has to pay tax on it's profits generated in the whole of the EU in the country where it is registered.
So if Apple Ireland sells a iPhone in the UK or Germany the profit it makes on that is taxable in Ireland.
The problem is that Ireland cut Apple a special deal that says Apple only has to pay taxes on the profit made in Ireland. That's great for Ireland because it attracts Apple to locate it's headquarters in Ireland and that provides jobs, and they still get all the tax they otherwise would have.
On the other hand the rest of the EU is royally pissed off, and have decided that it amounts to illegal state aid, hence the fine. I believe in no particular order Microsoft, Dell and Google also do the same, so expect to see requirements for large back tax bills for these firms too in the not too distant future.
This is quite separate from the sell brandnames at inflated prices tax dodge that the likes of Starbucks operate.
It's also separate from the Amazon we don't actually make profits because we reinvested it all to grow the company so no tax to pay scheme that Amazon have historically operated. This is not a tax dodge in my view but Amazon have been almost unique it operating it for such a long period of time that it has been unfairly branded as a tax dodge.