They got $5 back but gave the bellhop $2, so that's the amount that should equal 3*9, and it does. The additional 3 dollars are in their pockets. They each paid $9 including tip, not before tip.
Your equation could read (for sake of clarity) 3*$9= $30-$5+2
But also, yes, your trickiness made me scratch my head for several minutes. An excellent deception! (I mean, "riddle".) ;P