It gets quite ridiculous sometimes, especially since 2008. Governments are looking for cash everywhere, and they don't mind challenging whatever comes their way.
It doesn't cost them anything to challenge arrangements, so why not try? At worst, they lose and they will have lost some time. Civil servants are being paid anyway. At best, someone pays up because they realise it's not worth the fight.
I read about a case here in Belgium where there was someone who wanted to move to Spain for non tax reasons. The tax administration levied an additional tax on some of his income, because they said his move to Spain was motivated by tax avoidance reasons. A judge ruled on the matter, saying they have no right to keep taxing someone who just wants to relocate, especially when it was pretty clear tax wasn't the motivation.
The fact is, they tried anyway, costing this guy tens of thousands in legal expenses. He was only granted a few thousand by the court as compensation.
If you have to pay €10-20k for a decent lawyer to deal with a case, that tax lawyer in turn will be taxed on that income at income tax/corporate tax rates (+ VAT tends to be charged as well).
It's a pretty decent strategy for a government, but not one I would appreciate if someone were to use it in a business setting.
I heard (don't recall where) that a while back someone proposed a new tax in Sweden: "tax on work that was avoided with the intention of avoiding tax".
I.e. a doctor was working 40 hours a week and was paying >50 % of income as taxes, and decided that it's not worth it to work so hard if government takes most of the proceeds, so reduced working time to 35 hours a week.
The proposal was to tax him/her anyway on the calculated income of those 40 hours, because quite clearly working only 35 hours was an arrangement just for the purpose to avoid tax.
This is apocryphic, and anyway didn't go through even in Sweden.