You're absolutely right! This is precisely why loopholes in tax systems, which come into being as a result of legislature, have remained a purely theoretical threat to government budgets, all over the world.
Tax loopholes are mostly intentional. If the government actually wanted to close them, they would; it's not that hard. There's just no political will to do it.