In support of what you're saying: many countries (but not the US) take a less punitive approach, preferring to focus on harm reduction.
For example in the UK, needle exchanges - places where you can get clean needles and other paraphenalia - have been well established since the late 1980s to help protect people who inject drugs against the infection risks of needle sharing. It's been credited with greatly reducing the prevalence of HIV and hepatitis viruses amongst that population.
Similarly, heroin addicts are often prescribed synthetic opiates such as methadone and buprenorphine, to prevent their reliance on dealers. This doesn't much reduce deaths from overdose, but does seem to prevent societal harm. Indeed if you are charged with theft or robbery and it turns out that it was to help feed your opiate addiction, it's not uncommon for the judge to offer access to a treatment programme in lieu of a custodial sentence.
There is however a problem with user compliance. Some recent research over the past decade or so has been in 'contingency management', where addicts are offered financial rewards to attend or comply with such treatments. It's very controversial and so far has had mixed results, but the idea is that the overall cost to the state will be reduced, in that a small 'bribe' can put people on the right path, hopefully leading to feeling more intrinsically rewarded by the success of the treatment, and that is less expensive than medical treatment later on.
But despite all this, as you imply, it does need the political will behind it to have any good effect.