Stephen Dickson, 36, stored large quantities of the illegal powder in order to get a discount on the narcotics he was buying from fellow dealers.
The High Court in Edinburgh heard Dickson, of Brunstane, Edinburgh, was arrested after police received intelligence on his activities.
Detectives raided his home in the town’s Magdalene Gardens on November 8 last year and found more than five kilos of the class A powder.
Experts concluded that the heroin could have netted crooks a maximum of £442,940 in profits.
Police also discovered £8,420 in cash at the house.
The story emerged after Dickson, now a prisoner of HMP Saughton, pleaded guilty on Tuesday to being involved in the supply of drugs between September and November last year.
Prosecutors have also now raised proceeds of crime proceedings against Dickson.
Defence advocate Kevin McCallum told judge Lord Burns that his client had a minor role in drug dealing.
Mr McCallum added: “He allowed his property to be used for storage and packaging purposes. His reward for that was access to heroin to satisfy his own habit.
“He is shocked about the proceeds of crime action being raised against him. He has no assets.
“He is entirely realistic about the prospects of receiving a custodial sentence for his role in the activity.”
Lord Burns jailed Dickson for six years and said that if he hadn’t pleaded guilty, he would have received a nine year stretch.
Lord Burns added: “If it were not for people like you, who are willing to participate in such activities, the whole drugs trade would grind to a halt.”
Dickson will appear again in court later this year on proceeds of crime charges.
Join our Facebook group Our Edinburgh to share images and news from and around the Capital