Zahir Hussain, 41 and from Birmingham, studied business while running a crack cocaine and heroin operation, like Idris Elba's Stringer Bell character in the US TV drama, police said.
He was jailed for six years and three months last December.
At a further Birmingham Crown Court hearing, Hussain was told to pay the cash or face a further year in prison.
More updates on this and other stories in Birmingham and the Black Country
Police described his drugs operation, run on the phone network he named after himself - Zee Line, as a "sophisticated" operation. Arresting officers recovered class A drugs, £10,000 in cash and mobile phones which linked Hussain as the ringleader.
Elba appeared in the long-running US TV crime drama between 2002 and 2004, which saw his character Bell become a major player in a drug dealing network in Baltimore.
PC David Harman, financial investigator at West Midlands Police, said messages on Hussain's phones showed texts to drug users boasting about the quality of the drugs, advice to runners about how to boost sales and demands for sales figures.
"Hussain had been studying small business management, similar to Idris Elba's character Stringer Bell in TV's The Wire, and course books were found inside the flat," he said.
"Further messages showed desperate drug users offering personal belongings in exchange for drugs, highlighting the misery being brought upon the community."
The recovery team began investigating Hussain following his jailing last December after admitting conspiring to sell drugs.
"They discovered that cash deposits were passed through a company controlled by Hussain − which claimed to sell toilet rolls and bin bags - and he still held assets worth £38,000," a police spokesman said.
Following a Proceeds of Crime hearing at the same court last Thursday, he was ordered to pay that money back.
A drug dealer who was like "a character in The Wire" has been told to pay back almost £40,000 he made from his crimes.