Yes, but then not selling it in stores for recreational use ends in heroin being substituted with fentanyl (and other, even more effective synthetic opiates) in the dark market, because fentanyl is cheap to make and transport (way bigger potency for the same weight) and then killing many people who otherwise would not be dead.
The case for regulated legalisation is harder to make for opiates than for many other drugs, but still there.