Wayne Richardson was seen throwing the 55.3 gram package of spice over the wall of HMP Doncaster, as well as a mobile phone, Louise Gallagher, prosecuting, told Sheffield Crown Court on Friday.
At the time of the incident in June 6, 2015, spice was not illegal, and so the offence at that time would have been classed as the supply of a psychoactive substance into prison.
The package of spice that Richardson, aged 38, threw over the wall of the Category B prison had an estimated value of up to Â£2,750 - due to the cost of drugs being around five times higher in prison.
Ms Gallagher said: "When interviewed by police he said he had agreed to do this to repay a debt he had accrued at HMP Lindholme. Even though he had been released he was still being pursued for what he owed."
The court was told how Richardson had accrued a debt in prison, after becoming addicted to spice.
Richardson, of Swaith Avenue, Scawthorpe pleaded guilty to offences conveying a mobile phone and a psychoactive substance into prison at an earlier hearing.
When he appeared before Judge Paul Watson QC to be sentenced for the offences in November last year, Judge Watson said he wanted to defer sentence to see whether Richardson could work with the probation service and stay out of trouble.
Defending, Richard Hague, said: "He'd like Your Honour to know he's grateful for this chance. He's treated this as a challenge, and he's risen to it."
Judge Watson sentenced Richardon to 12 months in prison, suspended for 18 months.
He said: "You've done what I asked of you. You've done exactly what was expected of you and have kept yourself out of trouble.
"You've made special efforts to deal with your drug abuse problem.
He added: "I hope you won't, but if you continue to commit crimes you will go to prison."swathe