Dublin District Court heard that the garda was the subject of a criminal investigation and was no longer on the force.
Lyne, a gardener, was told to carry out community service to avoid a jail sentence.
Lyne, of Herbeton Road, Rialto, pleaded guilty to possession of drugs with intent to sell or supply at Sundrive Road Garda Station. The offence happened between August 1 and September 30, 2010.
Detective Garda Sean O'Brien told the court that officers from the NBCI carried out an investigation in late 2010 and early 2011.
Lyne was called to Harcourt Square and admitted the offence. The DPP directed that Lyne be charged and this was done on May 4.
"Can you be more specific?" Judge Victor Blake asked.
"The matter under investigation by us was in relation to a member of An Garda Siochana, who was a friend of the defendant and he supplied the drugs to his friend at Sundrive Road," Det Garda O'Brien replied.
The court heard that Lyne sold two deals of cannabis worth €50 each.
Lyne's barrister asked Det Garda O'Brien if he would agree that the offence was "more a favour for a friend rather than a business transaction".
Det Garda O'Brien agreed and added that Lyne had come to the garda station and fully co-operated. Lyne had seven previous convictions and had been given the benefit of the Probation Act on a charge of simple possession of drugs. Judge Blake told him to carry out 175 hours' community service instead of a three-month sentence.