Well the trick is in the puzzle itself and you should read it twice thrice to understand it.
When they pay 10 rupees each to the waiter they had given 30 rupees in total.
When waiter returns 5 rupees to them they have paid 25 rupees to the cashier.
Now the waiter return them 3 rupees so they have paid 25 rupees to the cashier and 2 rupees to the waiter.
so in total 25+ 3 +2 =30 rupees.
and the amount paid in restaurant is 25(cashier) + 2(waiter) = 27 = 3 x 9. So they pay 9 rupees each for the meal and got 1 rupee back.
When they pay 10 rupees each to the waiter they had given 30 rupees in total.
When waiter returns 5 rupees to them they have paid 25 rupees to the cashier.
Now the waiter return them 3 rupees so they have paid 25 rupees to the cashier and 2 rupees to the waiter.
so in total 25+ 3 +2 =30 rupees.
and the amount paid in restaurant is 25(cashier) + 2(waiter) = 27 = 3 x 9. So they pay 9 rupees each for the meal and got 1 rupee back.