It's illegal to quit as an employee and work solely for that employer as a freelancer. That would be considered a tax avoidance scheme. However, if your former employer counts as one of the several clients you work with and it doesn't account for more than 5/6 of your total income, it's fine.