In the riddle it is worded to make us think the math is off. If we really think about it the math is clear. When the waiter got the 5 from the cashier he put 2 in his pocket. The bill would go up to 27 dollars. That leaves 3 dollars for the customers. Any other math after this point is irrelevant because the dollar total is 30.