Legality is different than enforcement, but the two aren't totally separate.
For example, it's de facto not illegal to drive 5mph over the speed limit on the highway. No police officer will pull you over for that unless they have some other prior reason. So in that sense, lack of enforcement has made the practice legal.
What makes it more problematic is that it's not just tax offices that would be interested in finding out. The company you work at may also get in trouble with the tax office as they pay employment taxes too, so they are probably interested in the fact that you're deceiving them. If your manager suspects you're not being truthful and follows up with HR this could easily get you in trouble. As remote work becomes more popular, it becomes more likely that companies will pay attention to this.
Knowing all of that, I'd find it quite hard to justify playing these games. It just seems like asking for trouble, with a pretty good chance of getting it.