As far as I know, the 23rd century economy was a lot like the 20th's. Stuff still cost money, people who broke laws had to pay fines. The replicator changed all that. Now you can have anything you could want by just asking. Of course we have to take into consideration that the people of the 24th century seem to be a little more advanced than us poor 20th century barbarians, until they go at the Borg with a Tommy Gun.
I suppose that there is a centralized support system for all Federation citizens. Free medical, food, and shelter. But this is just the basics. People are encouraged to better themselves, and therefore rate more services. People living in the core worlds have it the "easiest". People further out have it pretty good. People out on the frontier might have it OK or look like Nimbus III.
I believe that the further from the core worlds you are, the more likely you will find that you will need money. OK , there I said it.
I figure that Starfleet gets paid in credits, but if they are not spent, they are saved up. If the officer never "buys" anything on leave or whatever, they just store up. When that officer decides to leave Starfleet or retire. Those stored up credits can be used to settle down or buy whatever the officer wants. The pay scales I've seen look right. If a month of OK living is 1000cr then an Ensign would make it. A recruit about half that. A senior NCO can usually make as much as a senior officer or a captain if they have enough time. And don't forget dependants. You get a bonus for familiy.
"Retreat?! Hell, we just got here!", annonymous American Marine, WWI
"Gravity is a harsh mistress....", The Tick