I don't have any rigor behind this, but my theory is that credits are used external to the Federation. And that transactions between Federation citizens are essentially cashless.
This lets the Federation trade with societies that value money (the Ferengi) yet not get all caught up in internal accounting.
With replicator technology, a Star Fleet officer could produce all the gold pressed Latinum he wants. But that would obviously have bad effects on the Ferengi economy, so there's a moral rule in place (perhaps enforced with limits in the replicator code) not to do that.
This lets the Federation trade with societies that value money (the Ferengi) yet not get all caught up in internal accounting.
With replicator technology, a Star Fleet officer could produce all the gold pressed Latinum he wants. But that would obviously have bad effects on the Ferengi economy, so there's a moral rule in place (perhaps enforced with limits in the replicator code) not to do that.