Ah, I was assuming the drug addict (or at least a signification portion) wouldn't be getting clean. A large part of Portugal's policy is focused on safe drug use (decriminalization, clean needles, drug dispensaries, etc.).
Consider this: if drug use is criminalised, then seeking help increases your risk of getting arrested!
It's worse than that. If someone is working a productive job, even if they don't make much, they're doing something useful. Someone has their dishes washed or their floors swept and there is a surplus that accrues not only to the worker but also the rest of society.
If someone is in prison, not only do you lose that surplus, you have to extract tax dollars from some other productive activity and use it to pay prison guards and consume real estate, which money could have been used by the government to do something useful, or to lower taxes so the taxpayer can do something useful.
Prison is an enormous net loss on both ends.
While I agree that the prison-scenario costs are probably underestimated and underappreciated... If we're going to try to measure the "doing something useful" part, we should also consider the other side of "doing something destructive to other people and property" part.
Someone could hold down a job and be cutting catalytic converters out of other people's cars.
Suppose nonviolent criminals get sentenced to restitution and community service and only go to prison if they fail to complete their community service. Now you want to go out stealing catalytic converters and you're going to find that doing a bunch of free labor while giving half the wages from your paid labor to your victims is a lot less profitable than just doing honest work.
Citation needed, you might be underestimating how much it costs to jail someone. If a drug user actually manages to get clean (which with proper support, most can) then the cost of support is basically checking up on them a couple of times a year. Meanwhile they can hold down a job and live a normal life.
That's as opposed to the significant costs of keeping someone in prison, which is significantly more than they would be earning if they were free.