A man who grew nearly 700 cannabis plants in his garden shed claimed they were to produce oil for pain relief.
Charles Nichols admitted cannabis production but said the plants were for his own use.
At Norwich Crown Court, Judge Stephen Holt accepted that Nichols, of North Pickenham, Norfolk, suffered from chronic pain and arthritis.
But he rejected Nichols' claim all the plants were for personal use, and gave him a two-year suspended sentence.
The plants were found in the shed in Houghton Lane when police raided it in February 2018 after a drone alerted officers to heat coming from the site.
When arrested Nichols told police he had got "carried away" with the cannabis cultivation, the court heard.
Nichols told the court he had exhausted conventional pain remedies.
"I saw a television programme about cannabis and how it can help people and I...got information from the internet," he said.
Emma Reed, defending, said her client had shown "genuine remorse" and his medical conditions meant a custodial sentence "would be devastating for him".
Judge Holt said he thought some of the cannabis would have been sold on and there may have been a mystery dealer pulling the strings.
"I do not accept you were growing them entirely for your personal use," he said.
The judge said he had taken Nichols' age and medical conditions into account when sentencing him to a two-year jail term, suspended for two years.
He was also given a concurrent three-month sentence for abstracting electricity.
Judge Holt ordered that not guilty verdicts be returned against Nichols' wife Helen, who was also charged with cannabis production and electricity abstraction, after the prosecution offered no evidence.
The judge criticised the length of time it had taken to bring the case to court.