Why is the European Union going after Apple for $14 billion in unpaid taxes?

Consider this: In 2014, the corporate giant paid just $50 in tax for every million it made selling iPhones and iPads to most of the world outside America.

That's a tax rate of just 0.005%. Yes, you read that correctly.

So how was that allowed to happen?

Apple has funneled most of its profits from Europe, the Middle East, Africa and India through Ireland for decades. Nothing unusual in that. Others do it too.

But under deals the company struck with the Irish government as far back as 1991, it was allowed to split these profits between its Ireland branch and an Apple head office that existed only on paper.

Apple paid the standard Irish tax rate on profits booked to its Ireland branch. Those it allocated to the phantom head office were tax free, because under Irish law it was then considered a "stateless company."

Guess where most of the profits went?

In 2011, Apple Sales International made 16 billion euros in profits. Less than 50 million euros were allocated to the Irish branch. The rest went to the "head office," out of reach of any tax authority.

It was an arrangement that also suited the Irish government.

Ireland has set its corporate tax rate at 12.5%, one of the lowest in Europe, to attract big companies to the country.

Apple (AAPL), Google (GOOGL), Facebook (FB), eBay (EBAY) and Twitter (TWTR) have all set up their EU headquarters in Ireland.

And with them came the jobs. Apple employes 6,000 people in Ireland, many of them making iMacs at a factory in Cork -- once a deprived city in the south of Ireland. Apple says it is the biggest private employer in the city.

EU states can set their own rate of tax. But European officials say Ireland's arrangements with Apple gave the company such a huge financial advantage over its competitors that it constituted illegal state aid.

Apple doesn't want to pay the tax even though the $14.6 billion, plus interest, it might have to repay constitutes just 5% of the $231 billion in cash it has on its books.

Ireland doesn't like the ruling either, calling it an "encroachment" into its sovereignty. The country said Apple has paid what it owed in Ireland.