Tax avoidance=legal. Tax evasion=illegal
It's not that simple, particularly in the digital age.
Some things, like the re-routing of online sales transactions through other countries was legitimate in the UK and now it isn't. But even after the 2015 'diverted profits tax' it's not actually illegal, it's just that if you do so you have to pay an extra 25% tax.
At the same time as the dpt came in, there was also a government decision to clamp down on complex accounting manoeuvres to recycle tax advantages from tax losses, which, again were previously legitimate; and new criminal offences for tax evasion and fresh penalties for advisers who assist in evasion. So some activities that were legal became illegal.
There's a general tendency to exploit legal loopholes, or areas where the law is unclear. I've been offered schemes by tax accountants that start 'its not technically illegal but...' Which I always avoid.
So, I think there can be genuine confusion over what is legal and what isn't.