Well-paid freelance developers usually IR35 - set up a limited company, pay themselves the smallest possible salary which avoids National Insurance contributions, and take the rest as dividends.
This used to be an easy way to minimise tax, although now it's a more complex calculation. And HMRC have to be persuaded that you really are freelance, and not just a long-term contractor working on-site.
There other semi-legal dodges including companies which loan you your income - minimal tax - and then for various more or less credible reasons the loan is written off and never has to be repaid. HMRC usually take a while to catch to these kinds of schemes. But short term gain can lead to long-term pain because if they're ruled unlawful HMRC can claw back tax retrospectively.
I moved out of the UK a few years ago, and while there's a lot to dislike - which is why I moved - the tax laws are fairly generous to one-person small businesses. Brexit has now massively complicated this for anyone selling internationally, but UK B2B is not so bad.