Thomas Newsome left a carrier bag containing the high purity class A drug when he went into the store in the White Rose Centre in Leeds.
A member of staff found the bag and took it to a manager who made the discovery and contacted police.
Leeds Crown Court heard Newsome, 23, returned to the store moments later and was seen searching for the bag.
Robert Galley, prosecuting, said: "He went to a shop assistant and said 'where's the bag?'
"He said he and the shop assistant would be 'in a lot of trouble.'"
Newsome then left the store empty handed with his friend.
The pair got into a taxi outside the shopping centre after the incident on February 7, 2018.
The bag was found to contain 779 grams of cocaine that was of a 90 per cent purity and divided into 28 separate smaller bags.
Newsome was recognised from CCTV footage of him getting into the taxi.
Police were able to trace the vehicle and the defendant's mobile phone was found inside.
The phone was analysed and found to contain text messages linking Newsome to drug dealing.
Newsome, of no fixed address, pleaded guilty to possession of cocaine with intent to supply.
The court heard he is currently serving a prison sentence for dangerous driving and handling stolen goods.
Those offences relate to him being involved in a high speed police chase in a car that had been stolen during a house burglary.
Aubree Sampson, mitigating, said Newsome had been selling drugs on behalf of those higher up the supply chain in order to fund his own cocaine habit.
Newsome was jailed for five years and four months for the drugs offence.
After the case, Detective Sergeant Rob Kennerley, of Leeds District Crime Team, said: “This was a very significant amount of high purity cocaine that was stopped from being dealt on the streets of Leeds thanks to Newsome’s moment of forgetfulness and the diligence of the shop staff.
“We know only too well that Class A drugs such as this fuel serious violence and associated crime and anti-social behaviour, and bring misery to communities and to individual users and their families.
“We hope the significant prison sentence that Newsome has received will serve as a very clear warning to those who involve themselves in the trade in illegal drugs.
“I’m sure he will since have reflected that there may have been a better time to go shopping for trainers.”