A customer buying cocaine from the son of a Cork County Councillor offered to milk cows in exchange for the drugs.
Barry Coleman, 30, and son of Independent Cllr Alan Coleman, was given a 10-month jail sentence for the sale and supply of cocaine, with Bandon District Court hearing that some customers collected the drug at his farmyard and dropped the money there in exchange.
Mr Coleman, of Ballinacourtha, Belogooly in Co Cork and a dairy farmer, had already pleaded guilty and a probation report had been requested.
However, when it came to determining penalty Judge James McNulty noted what he called "inconsistencies" between some of what was contained in the report by the Probation Service, and the evidence of investigating gardaí.
It resulted in Det Garda Colin O'Mahony giving details of how Mr Coleman was found at Cois Bruach, Curra in Riverstick on April 5 last year with three bags of cocaine and €230 in cash, and also of the string of text messages found on a black iphone which indicated the extent to which he was supplying drugs to others.
Det Garda O'Mahony said he was on plainclothes duty in Riverstick when he came across the accused at 10.20pm.
A search uncovered the drugs and other items, though Mr Coleman initially denied any sale or supply element.
He later admitted to using cocaine, saying he had done so for between nine months and a year and did between two and six lines a night at weekends.
He repeatedly denied supplying to others even though Det Garda O'Mahony said "the messages told a different story".
"The messages indicated involvement in the selling of drugs in the locality to a large group of regular customers over an extended period."
This included people collecting drugs from different parts of the dairy farm and leaving cash there, or paying through internet banking.
"One customer offered to work for drugs on the farm," Det Garda O'Mahony said.
Judge McNulty then read through a sample of the text message exchanges, one of which said "Any chance of a fifty for Sunday? Or I can milk for you Sunday, I'm off".
Other messages related to 'white' and 'green', and Det Garda O'Mahony said at one point Mr Coleman tried to explain this away as referring to grass and hedging.
Other exchanges highlighted how the farmyard was where drugs were collected. "Go through that yard straight up to the top yard," read one message. "I'll be milking. Go straight on up to the dairy."
Mr Coleman had been charged with possession and possession of drugs for the purposes of sale and supply.
The court heard he was a "substantial" dairy farmer and that the farm was currently in the process of being transferred to him.
His solicitor, Diarmuid O'Shea, said his client had "turned his life around" and had undertaken addiction counselling, but the judge queried why in the probation report Mr Coleman had "underplayed" the extent of his drug activities.
Judge McNulty described it as a "grave offence" and "despicable", adding: "It is clear to me what he wanted to do was fund his drug use from the profits made selling to others.
"It's really quite abhorrent to decent people that a man who has so much should involve himself in selling cocaine to others, many of whom have so little in comparison to him."
He remarked on how one customer had offered to do milking in exchange, adding: "as if the profits from dairy farming weren't good enough".
He handed Mr Coleman, whose father was present in court, a 10-month sentence and fined him €2,000 on the possession charge.
An appeal was lodged on Mr Coleman's own bond of €1,000, no cash required.