Stop in to your friendly neighborhood Walgreens for a flu shot? How about a pint of Old Grand-Dad?

Add it to the list of “ingenious ways to take advantage of legal loopholes” alongside tax shelters and evading repo men: the biggest pharmacy chain in the United States—8,232 stores and counting—actually built itself up by writing prescriptions for hooch.

In 1920, when the Volstead Act was passed, America dried up, right? Not quite. Besides all the bootlegged and Tommy-gunned and Al Caponed booze, two classes of alcohol were still legally permitted under Prohibition: sacramental and medicinal. According to Sections 6 of the Volstead Act (which makes for a surprisingly good read, provided you’ve had a drink or two) “a person may, without a permit, purchase and use liquor for medicinal purposes when prescribed by a physician as herein provided.”

The 1920s were still the good old days when alcohol could be taken “medicinally,” kind of the way cures were taken by the sea and doctors actually practiced something called “craniometry.” Interestingly enough, in 1917 the American Medical Association had actually taken alcohol off its list of permitted medical therapies. More interestingly—and maybe no coincidence at all—by 1922, two years into the 13 year dry spell of Prohibition, the AMA changed its mind, and booze was back on the prescription pad.

Not that you could just strut into your local pharmacy, sniffle, and walk out with a pint of whiskey. You had to get a prescription. Per Section 7 of Volstead: “No one but a physician holding a permit to prescribe liquor shall issue any prescription for liquor. And no physician shall prescribe liquor unless after careful physical examination of the person for whose use such prescription is sought, or if such examination is found impracticable, then upon the best information obtainable, he in good faith believes that the use of such liquor as a medicine by such person is necessary and will afford relief to him from some known ailment.” (Yeah, they were awkwardly wordy, but remember, they were sober.)

The list of “known ailments” alcohol might be prescribed for was equally…flexible, based in large part on the opinion of the physician: anything from influenza (OK…) to diabetes (there’s always wine for that) to lactation therapy (wait, what?), and, our favorite, old age. (Beer, it should be noted, moms, was more commonly prescribed for lactation issues.) Compare that to the list of conditions approved to get your “Red Card” in Colorado, and the hot box Centennial State actually seems pretty strict. (California, on the other hand, is a bit more lax in their qualifying conditions—though nobody, so far, prescribes pot for old age.)

There were limits—“no more than a pint of spirituous liquor” per person, per 10 days. And you could only use a prescription once. Still, it all seems pretty easy, especially if you noticed this phrase in the law: “if such examination is found impracticable, then upon the best information obtainable,” which sounds a lot like “if you have the right shady doctor, give him a call, send him a telegraph, and get yourself some legal booze.”

So how does this all lead back to Walgreens, the friendly pharmacy chain that was (at least for a while) voiced by everyone’s favorite Carrie Bradshaw-contender John Corbett? It all comes back to the ingenuity of Charles R. Walgreen—yes, that’s his name—who founded the pharmacy in Chicago in 1901. To be fair, Walgreen was moderately successful without whiskey. By 1919, he had around 20 stores. But once Prohibition came into effect, business took off. By 1929, Walgreens had well over 525 outlets. The way Walgreens tells it, that growth had nothing to do with whiskey, but things like “a superb management team” (booze), “modern merchandizing” (whiskey), “innovative store design” (hooch), and “exceedingly high pharmacy quality and service” (exceedingly high ABV).

Walgreens does admit to one beverage possibly fueling their unprecedented growth, but it wasn’t whiskey. “One can’t overlook something that may have seemed a minor innovation at the time. This was the invention of Walgreens immortal malted milkshake, an instant classic.” As much as we’d like to think a 2500% increase in business was caused by our sober and obedient consumption of milkshakes (they are great), it’s far more likely attributable to the fact that pharmacies and church were the two legal pipelines to alcohol, and pharmacies didn’t care if you were boozed up and going to hell.