Ive always looked at the star trek economy as, the gubbamint provides the necessities, home, food, power, etc. Luxuries you have to earn for yourself. So there has to be some form of cash economy as well as the standard rations doled out to everyone automatically. Its not just ferengi gambling at quarks after all, plenty of humans go there too, so they have to get ahold of gold pressed latinum somehow.