But Underhill could not resist taking some of the cocaine, which he found on the beach near his home at Caister-on-Sea.
He admitted being concerned in the supply of cocaine between November 1 last year and March 4, and possessing cocaine on March 3 this year.
Andrew Oliver, for Underhill, said he was on the beach when he discovered the cocaine washed ashore.
Oliver said: "He sent a message to someone saying he had found Willy Wonka's golden ticket."
He said Underhill had told the person not to say anything, but word had seeped out of his incredible find.
Oliver added that Underhill was a user of cannabis and crack cocaine and had supplied some of the cocaine he found and also used some himself.
Judge Katharine Moore adjourned sentencing until October 31 but warned him that all sentencing options were open
She added: "On the face of it, custody here is inevitable."
Prosecutor Chris Youell said the pleas offered by Underhill were acceptable to the prosecution.
He described Underhill as a cannabis dealer who had come across the cocaine on the beach.
Youell added: "He does sell some of it and uses some of it as well."
He accepted that Underhill had no involvement in the consignment of cocaine and had just found it.
Youell said: "He is not of that ilk."
The bags of drugs were believed to have been tied up to buoys offshore by smugglers so they could be brought ashore by smaller boats.
But it is thought that the bags landed up on the beach after being swept away by strong winds and waves.