So you are saying if people get addicted to heroin... give them free heroin indefinitely until they decide to stop (or die of old age)? Why pay for it if your healthcare covers it? Why not extend it and prescribe alcohol to alcoholics and nicotine to smokers?
That's not how it works. It's a coping mechanism.
If you give people the support they need to be happy without using it, and then slowly taper off the drugs, they stop using them.
Drug addiction is a social support problem.
You can buy alcohol and tobacco legally and relatively inexpensively. Substitute prescribing allows addicts access to a safe supply of drugs without creating a free-for-all. Substitute prescribing massively reduces the cost to society of drug addiction, for the reasons mentioned in my comment.
If alcohol was illegal, people were being killed by bathtub gin and people were burgling houses to fund their addiction, I'd suggest prescribing alcohol.
No, they'd just be addicts. If you prescribe heroin to addicts, a large proportion of them become productive members of society. Prescribing is incredibly inexpensive, because heroin is in fact a very cheap drug - it's expensive on the streets because of prohibition.
Switzerland and The Netherlands routinely prescribe heroin to treat addiction. By stabilising the lifestyles of addicts and bringing them into contact with the healthcare system, their cost to society is vastly reduced. Addicts with a prescription don't commit crime to fund their habit, they don't acquire blood-borne infections and they almost never overdose.
In Switzerland in particular, heroin has become an old person's drug, with a sharp decline in use among young people. The country has heroin addicts, but it doesn't have a heroin problem.
Harm reduction works.
https://en.wikipedia.org/wiki/Heroin-assisted_treatment