In America, so much is illegal that you probably commit multiple felonies a day. Thus, if you selectively apply the law, you can direct the behavior of particular individuals.
However, your comparison is a false equivalence. The core problem with socialism is that it CAN’T create an individualized plan for every human being in the economy. Instead, it must paint with extremely broad strokes. For instance, in the Soviet Union, they cooked food out of one single cook book, “On a a delicious and health diet” or something like that.
The kinds of directives being given in Obamacare, for instance, are of the exact same variety as the kind given by the Soviet Union.