“The N.R.A. is different from most traditional trade associations in our business model,” Dawn Sweeney, the National Restaurant Association’s chief executive at the time, wrote to members in 2014 — reminding them of what a good deal they had.

Business leagues, which are tax-exempt, are generally allowed to run a for-profit business, as long as it advances the common interest of their broader trade. The National Restaurant Association contends that its business cleanly fits this standard.

“The rules the I.R.S. has passed are not always clear as to what is and is not allowed,” said Anna Massoglia, an investigations manager at OpenSecrets, a nonpartisan group that tracks the flow of money in politics. “This makes it easier for groups to exploit that lack of clarity. I’m not familiar with another group that has done it to this scale.”

The Internal Revenue Service declined to comment, citing taxpayer-privacy rules.

For restaurant workers, there is little clue that money paid to ServSafe supports lobbying — much less lobbying that tries to keep workers’ pay low. The only hint is a line on ServSafe’s website, saying it “reinvests proceeds from programs back into the industry.”

Even some members of the restaurant association — the beneficiaries of this arrangement — said they did not know how it worked.

Johnny Martinez, a Georgia restaurateur, said he supports a $15 minimum wage and pays at least that much in a state where it is still $7.25 per hour. And he describes his association membership as “the price of entry” for navigating the industry, “even though I disagree with them on a lot of things.”

But he expressed frustration upon discovering the connections between ServSafe and lobbying efforts, saying “it feels very wrong” to him.

“This is a certification that’s also wrapped up inside of a lobbyist,” Mr. Martinez said. “It is weird that the tests that they require the workers to pay for are being run by the same company that’s fighting to make sure those people don’t make more money.”

Tiff Fehr and Will Houp contributed reporting.