So basically Google inc (in a tax haven) makes Google Spain pay for the use of the Google brand 8 billions. Google Spain never makes a profit since it needs to pay a fee for using the brand, thus never have to pay taxes on their huge profit, that's how they get away with it. Apple does it too, with Apple Ireland in Europe.
Then Google US and Apple US just have to wait for a tax amnesty in the US in order to bring back oversea un-taxed profits.