The error in the calculation is in adding up the wrong numbers. The three friends paid a total of $27 for the room ($9 each) and gave the porter a $2 tip, making the total expenses $29. The extra dollar is not missing, but it was never part of the expenses in the first place. The mistake arises from adding up the $27 they paid for the room with the $2 tip they gave the porter, which gives $29. However, this sum includes the $3 they got back from the hotel, which should not be included in the expenses since they received it back.
Another way to think about it is to subtract the $3 they got back from the $30 they paid initially. This gives $27, which is the amount they actually spent on the room. Then, when they added the $2 tip for the porter, the total expenses for the weekend were $29, as expected.
So, the mistake is not in the missing dollar, but in adding up the wrong numbers.