Ok, each guy gives $10. Let's say that is all they had in their wallet. They had nothing left when they went in to train. The guy gives them back $5 in singles. They each keep $1 and give him a $2 tip. That means they each have $1 left in their wallet and their net cost was $9 each. $9 times 3 equals $27 plus the $1 x 3 = $3 left in their wallets which accounts for the original $30.
When you posed the teaser you state they spent $9 each PLUS the $2 tip and this adds up to only $29 but that is not what occurred. As already stated by others the $9 each x 3 = $27 includes the $2 tip they doled out. The teaser essentially is just poor math as it double dips the tip in an attempt to fool the reader. What really happened in the money trail was $32 was given to the gym or the guy (outgo on the trainees' part) and $5 was returned to them (incoming) which is a net flow of $27 or $9 each.