It costs about $38,000 a year to incarcerate a person for one year in Washington State (FY2019 Cost per Incarcerated Individual per Day — All Facility Costs).
According to the National Institute for Drug Abuse,
The substantial prison population in the United States is strongly connected to drug-related offenses. While the exact rates of inmates with substance use disorders (SUDs) is difficult to measure, some research shows that an estimated 65% percent of the United States prison population has an active SUD. Another 20% percent did not meet the official criteria for an SUD, but were under the influence of drugs or alcohol at the time of their crime.
Heroin can be produced very cheaply, and can be made to be safe to use.
Because heroin is illegal and hard to get, addicts have to steal to support their habits. This causes all sorts of suffering for victims, and costs for security, emergency room visits, police work, courts, and prisons. It also gives billions of dollars in profits to black market producers and to drug gangs overseas.
The war on drugs is a dismal failure and ends up doing more harm than good. Society should make cheap opiates available, with a prescription, for addicts, so they don’t have to steal. This seems wrong but it’s probably cheaper in the long run.
Likewise, there are unsafe injection sites all over our communities. Hence the many drug overdoses and deaths. Far better to have supervised safe injection sites.