Heroin addicts are not taking it because they need a pain killer. They take it for recreation.
They take it because they are addicted. Many become addicted from recreational use, but many others become addicted from using prescription pain killers for chronic pain. When they can no longer get any or enough from their doctor they look elsewhere. Going to multiple doctors used to be one way (ask Rush Limbaugh) which is one of the reasons the DEA made it harder for MDs to prescribe them, whether for legitimate needs or not. But my point is even “cheap” heroin is more expensive that prescription pain killers.