I always supposed that "turning tricks" was more a reference to the "tricks" in a card game, where the one who "takes the trick" wins the advantage.

Am I correct? Or does it follow from meretrix or something else?