They release their artificial
endorphins to them, and block the bodies natural
endorphins. After a while the neurons that produce the body's natural endorphins disappear. There is no need for them so they just don't rejuvenate like they would normally.
When you stop taking the opiates, they leave your opioid receptors bare, and they are calling out for your body's natural endorphins, but there isn't any there at first.