From Snopes, https://www.snopes.com/are-diners-obligated-to-pay-mandatory-gratuity-or-tip-charges/
...
Further muddying the waters is that as of 1 January 2014, the Internal Revenue Service decided that any form of mandatory gratuity is paid not to the server but to the restaurant (as a measure to ensure taxes are paid on tips):
The change actually came in June 2012, when the IRS issued Revenue Ruling 2012-18, which said that the mandatory extra fee restaurants often add to large parties is not a tip at all. A tip, it ruled, must be voluntary in every sense of the word. Customers must feel free to leave any amount they choose or nothing at all. Instead, such mandatory add-ons are a service charge, a fee that must be paid if a customer wants to leave the restaurant without handcuffs.
This is much more than just simple semantics. You see, if an employee relies on tips for part of his or her income, an employer only has to pay a minimum wage of $2.13, according to the Department of Labor. Only if the employee doesnt make enough in tips to meet the prevailing minimum wage (now $7.25 at the federal level) does the employer have to make up the difference
the IRS knows this has led to lots of number-fudging. For example, all employees who make more than $20 in tips must report them to the employer each month so that taxes can be withheld. But if the employee is less than honest and the employer looks the other way or under reports tip income, both parties can come out ahead while the federal government is left holding the bag.
...
Seems like the bookkeeping could get pretty complicated, if you're charging a mandatory "gratuity" to some customers and not others.