The Federation was supposed to have eliminated capitalism by Picard's time
And even that is debatable. In ST:FC, Picard says that the acquisition of wealth "is no longer the driving force", he doesn't say it has disappeared. Even if you believe him (which I don't).
although other races still used money in DS9. In fact, in Kirk's time they still used credits.
They do in TNG and later, as well. Remember these:
- TNG's pilot ep, where Beverly buys something and tells the shopkeeper to put it on her account
- Sisko tells of how, when he was at the Academy, he used up a lot of credits because he beamed back home for dinner every night
- A late TNG episode where Riker cashes in all his Federation credit vouchers at Quark's bar, to get Quark to give him information
- TNG's "The Price"; the Federation negotiates for wormhole rights, paying CREDITS for it
- DS9 "Honor Among Thieves"; Bolias, a Federation member world, has its own bank