The answer to the puzzle:
Each person pays £9, so in total they paid 3 x £9 = £27.
This covers the cost of the meals (£25) and the waiter’s tip (£2).
Adding the tip is wrong, as it is already included. You are adding it twice. You should really include the three £1 returns to the customers:
3 x £9 = £27
3 x £1 = £3
£27 + £3 = £30, as required.