Because that has worked so well for:
* Drugs
* Media piracy
* Alcohol
* Sex work
* Unlicensed gambling
The government is not an all powerful entity with absolute control over its people. Even in countries under past and present dictatorship there are examples of people getting access to what the government deemed as illegal.
I was thinking of this one:
https://en.wikipedia.org/wiki/Executive_Order_6102
Of course you’ll always be able to get access but the risk can be made so high that most people won’t try it.
There are countries that have death penalty on dealing with drugs and really severe prison terms just for having a small amount of drugs. There are still people that do it, but most people are effectively deterred because it’s just not worth it.