This works thanks to liquidity providers, which are the ones who add funds to these groups.

Liquidity providers obtain fees from all operations that occur in the group that added funds.

The rewards are determined by the protocol and anyone can become a market maker.