Now, most of them are Iraqi security forces who recaptured the Gogjali neighborhood earlier this month and are pushing further into the city, which has been under ISIS control for more than two years.
As the militants retreat, civilians are adjusting to a new reality in their wake and a clearer picture is emerging of what they did to survive the punishments and deprivation of ISIS rule.
"Whether Daesh (ISIS) or army: my door is open to everyone," said Abu Osama, taking the blood pressure of an Iraqi policeman. "If my worst enemy comes here, I must treat him."
Several ISIS militants, both local and foreign, lived in Gogjali and it was mainly their families that visited the pharmacy because the militants themselves were often away, Abu Osama said.
The front of his shop and those next door are marked with the Arabic letter "z" for zakat, meaning alms, and beside it an identification number ISIS bureaucrats assigned to record donations made at the shop for their self-proclaimed caliphate.
Advancing Iraqi forces have sprayed Shi'ite slogans over it.
The 40-year old opened the pharmacy after Mosul fell to ISIS, and the salary he received as an employee of the Iraqi health ministry was cut by the government, as it sought to choke off funding to the militants, who were skimming the pay of public sector workers in areas they controlled.
The militants wanted Abu Osama to work for them in a hospital, but he refused because it would have meant pledging allegiance to the group, and he does not agree with their hardline ideology.
According to that ideology, the depiction of living creatures is un-Islamic because it can lead to idolatry. After a militant upbraided him for displaying a poster with an image of a baby on the wall of his pharmacy, Abu Osama blotted out its eyes with a black marker pen and then did the same to every label featuring a human being.
The 500 dinar note ($0.40), which bears an image of a statue, was banned for the same reason, according to several civilians.
Chinese, Indian medicine
All medicine came from Syria—Mosul's only outlet to the world as an array of forces slowly closed in on the city in Iraq. Syrian traders imported cheap Chinese and Indian medicine via Turkey and paid ISIS a tax to bring it to market in Mosul, Abu Osama said.
By the time medicine reached his still sparsely stocked shelves, the price had tripled, and many of his customers could not afford to buy it, so he sold it to them on credit and is now owed 1.25 million Iraq dinars ($1,016).
Abu Osama said that since women were obliged by ISIS to veil their faces completely, he cannot be sure who owes him what.
Standing in the pharmacy, forty-three-year old Sohaib commented that if he became separated from his wife in a crowded marketplace, she would have to find him, as he could not distinguish her from all the other women shrouded from head to toe in black.
Abu Osama could treat women only when they were accompanied by a male relative, and if a female patient lifted her veil before him and ISIS's vice squad found out, he would be held accountable. It never happened to him, but the militants punish such infractions with fines and whipping.
Residents of Gogjali said ISIS's laws were less strictly enforced there because it is far from the city center.
When Iraqi special forces took the neighborhood, two of the militants left their wives behind, locals said, identifying the women as Russian. The jihadi brides tried to flee Mosul among displaced civilians but were found out and detained by Iraqi security forces, according to a soldier sitting in the pharmacy.
"They were unbelievably beautiful," he said.
Several doors down, twenty-seven year old Ammar, who runs a grocery shop, said the ISIS militants were his best customers because they had more money than anyone else.
"They chatted with us and said we must fight jihad. Everyone preached to us, but each to their own," he said.
All the goods he sold came from Syria, he said, but now that route is blocked too, and several traders from the nearby Kurdish region are taking advantage of the opening in the market.
Outside the grocery shop, a Kurdish trader unloaded goods from a van, including items banned by ISIS, such as cigarettes, biscuits made in Iran and Brazilian canned meat.
"It says halal on the tin, but they said it wasn't," Ammar said, shrugging.