The law has always included consideration for this loophole. Every employee must at least average state minimum wage for their 80-hour paychecks, including tips.
So the employee has to record their tips (often but not always, in the same computer system they record their hours) and make sure their employer correctly compensated them for the shortfall between actual earnings and minimum wage.
Minimum wage laws basically says “Every employee must make the minimum wage when tips and employer payments are combined. Also, employers must always pay at least $2.13/hr (federal) regardless of amount that is earned in tips.”
The “real” issue is that $2.13/hr combined with averaging earnings over a paycheck leads to very very mismatched incentives for a business deciding what hours they should be open. The business has very low marginal cost so they’ll stay open during hours when it’s not profitable to the laborers because not enough customers ever walk in to make them minimum wage during those extra off-peak hours.