Harry Mudd got busted for (amongst other things)
purchasing a spacecraft with counterfeit currency in
Mudd’s Women and for
patent infringement in
I, Mudd, both of which imply the existence of some form of capitalist economy in the 23rd century UFP.
Did Mudd actually do this inside UFP space though?
Even if it may have been inside UFP space, remember that UFP does't strictly limit individuals on how they conduct their business (unless they start endgangering other people or try to smuggle banned or illegal substances).
The UFP as a government and most of its citizenry don't seem to need or use money/currency or means of exchange and live in a largely non-monetary economy (even Kirk mentioned money isn't used in the future).
In the 23rd century, its possible that planets on the fringes of UFP space were more 'ambiguous' when it came to economic standards and how people live their life - those planets were more 'removed' from UFP governance (and SF activity in those parts may have been less evident at the time due to the smaller fleet)... and depending on when they joined UFP, some may have needed more time to transition.
If I remember correctly, there was some mention of 'primitive Federation societies'... this could mean that back in the 23rd century (and maybe even the 22nd), less advanced species may have already been aware of space faring species and actively conducted business with them but otherwise didn't have Warp technology themselves (or they did but were far less advanced overall compared to the rest of Galactic community and had many unresolved societal and planetary issues), and they could have been allowed to join UFP due to less strict measures in that time.
Those planets might have only met the bare minimum to get accepted into UFP (which in turn also wanted to grow as an organisation) but for large scale changes and non-monetary economy to set place, they needed more time to incorporate.. so it looked more like a mashup of socio-economic systems with emphasis on money/currency in some parts of UFP early on which would have basically been taken cared of in the proceeding decades.
By the 24th century, the UFP may have tightended up its criteria for planets and/or species joining the UFP and insisted that Warp capable species had stable planetary governments with no conflicts and were actively working on transitioning away from monetary based economy - basically, to better prepare them for life in UFP and also avoid potential problems that may have become apparent in the 22nd and 23rd century from accepting planets that didn't have their act together.
So, in the 22nd and 23rd century, more leeway may have been given to less advanced Warp capable cultures (or even those that weren't warp capable but aware of aliens) and could have been admitted into UFP, which would make certain parts of UFP space (such as outlying colonies or recently admitted less advanced member planets) murkier in terms of economic standards which the UFP could have improved substantially after TOS and when Kirk's movies ended.
So, still non-monetary on a large scale, but some parts of it may have still used currency/money or some form of capitalism because they were in transitionary stages.
Plus, the 23rd century UFP also had to contend with some powerful 'lords' which may have slowed down elimination of monetary based economies in those areas and transition to non-monetary means... or those parts of space were never inside UFP space (at least not at the time).