This question already has an answer here:
I'm still unclear how Federation 'credits' work and who decides or assigns who gets how much. Does everyone get the same number of credits assigned to them or are credits assigned based upon position held or duties performed? Can someone increase their credit allotment by doing something different, special or extraordinary? Can everyone buy a spaceship, a yacht or a vineyard?
Note: Since there may be no answer to this in the episodes and movies, answers can include info from tie-in novels, etc.