Amaxing topic.
The possibility of jail may cause people to reevaluate their priorities, for their own good. They want the short term happiness from drugs, but if it is at a high risk of something that causes them unhappiness, also in the short term, they may choose to avoid the drugs -- resulting their own long term good.
I don't doubt that it doesn't work for a lot of cases. However some drugs (crack, meth, etc) have such an ability to short circuit the human motivation system, that doing nothing to prevent addiction from destroying lives is not necessary a good approach either.