Applebee’s has had a rough few years. As it strains towards its 40th birthday in 2020, the “Neighborhood Grill + Bar” chain closed more than 100 locations in 2016 and 2017, with plans announced in February of last year to close even more. But in the year since, it’s turned things around. It has the Dollarita to thank.

“We set a goal to become the most improved restaurant brand in America in 2018,” said Applebee’s president John Cywinski during the company’s most recent earnings call, “and we absolutely delivered on that goal.” Indeed, for the third quarter of 2018, its same-store sales grew 7.7 percent over the previous year, more than six times the industry average.

Driving a lot of that success is its too-good-to-be-true $1 Margarita—aka the “Dollarita”—which launched chain-wide in late 2017. Since then, Applebee’s has introduced a total of 16 different “Neighborhood Drinks,” a rotating set of $1 and $2 cocktails and beers available at nearly all of Applebee’s more than 1,700 outlets across all 50 states—all while turning a profit.

How, exactly? Patrick Kirk, vice president of beverage innovation for the brand, wondered the same thing. “A franchise in Texas started doing $1 Margaritas. We started to ask ourselves, ‘Is this even possible as a brand to do this nationwide?,’” he says, adding, “A drink special can’t easily be promoted in just one state or one market; word spreads really quickly online.”

Consisting of an ounce and a quarter of tequila and nearly four ounces of Applebee’s house Margarita mix (the company uses an undisclosed proprietary formula), there’s nothing terribly unusual about the Dollarita—other than its price tag.

The particular brand of tequila that each Applebee’s uses can vary, though. “For the Dollarita, we use well tequila,” says Kirk. “We work with seven or eight liquor distributors around the country to identify the best option for our franchisees.” A few phone calls yielded varying answers as to the well tequila of choice: in San Francisco it was Tequila 1800; in Chicago either El Toro or Montezuma; and in Queens, New York, one location cited Conquistador. What doesn’t change from location to location is that Applebee’s makes money on every Dollarita it sells.

While none of these tequilas are very expensive, it’s tough to run the Dollarita’s numbers without one single brand to point at. However, we can at least get some insight by looking at Applebee’s featured Neighborhood Drink for March, the Absolut Rainbow Punch, a $2 St. Patrick’s Day special that combines Absolut vodka with “green apple, ginger and lemon flavors” and is topped with a rainbow gummy garnish.

Let’s do some math: The best wholesale price you can get on Absolut from its New York distributor, Southern Glazer’s Wine & Spirits, is $15.99 for a 1-liter bottle. That’s if you buy at least 15 cases—180 bottles, or just short of 45 gallons—at a time. (Which, let’s be honest, should be pretty easy to do if you’re selling $2 drinks.) With a generous allotment for spillage, each of those bottles will pour twenty five 1 1/4-ounce shots, at a cost of 64 cents each. (This doesn’t even take into account the possibility that Applebee’s has negotiated an even better price—or even a kickback scheme—with Absolut itself, something that’s illegal but still widespread in the bar business.)

In California, where Southern Glazer’s also distributes Absolut, the best price is quite a bit higher: $16.43 for a 750mL bottle (if you buy at least 26 cases), for a per-drink cost of 91 cents. Either price leaves at least some room to cover the other ingredients—not to mention the labor—needed to make the $2 drink while still turning a profit. And considering there are plenty of tequilas that sell at retail for less than 10 bucks a bottle, a profitable $1 Margarita really doesn’t seem all that out there.

But Applebee’s isn’t making money hand over fist on the drink itself. Cywinski, in a story reported for CNBC, explained that “because [customers] are getting a great value on the beverage side, they tend to be ordering desserts and appetizers.” Kirk echoes the assertion that the drinks program gets people in the door, and has even expanded the restaurant’s demographic. “Our bars are more crowded than they were 18 months ago, and we’ve attracted a younger crowd with our Neighborhood Drinks program.”

The patchwork of liquor laws in the U.S. does throw a bit of a wrench into the Applebee’s plan for Dollarita domination, though not as much as you might think. “It’s a big country with lots of laws, and we want to make sure we’re compliant,” says Kirk. “We work with many of the state liquor authorities to make sure this is the right thing to do.” In New York, for example, customers are limited to three drinks, and in New Mexico, Applebee’s cannot sell $1 drinks (though it can sell $2 ones). Despite this, Kirk says, “nearly 100 percent” of the locations do offer Dollaritas.

“You see posts all the time that we’re using a half an ounce of tequila or doing something shady,” says Kirk. “I’m here to say there’s no smoke and mirrors.”