How is that different? The behaviour is made illegal, precisely because it's unwanted... that's pretty much the definition. I don't think there is another source of law in healthy cases/systems.
Not all unwanted behaviors are illegal. Some countries tax soda in order to reduce soda consumption. A behavior is not unwanted iff it's illegal. A behavior is illegal iff it's unwanted. It's not necessary for a behavior to be illegal in order to be unwanted. Illegal behavior is just a subset of the other.
But aside from that, and in this case, I feel the barriers to making it illegal are far higher than fining companies in other ways.