Here's a bit of Trek Wiki that might shed some light on the whole subject....
The Federation has been portrayed as an economic utopia. In the Star Trek: Voyager episode "Dark Frontier", Tom Paris describes it as the "New World Economy", which began in the late 22nd century and eventually made money obsolete, as does Jean-Luc Picard while explaining the timeline to Lily Sloane in Star Trek: First Contact.
The first mention of the Federation not using money came in Star Trek IV: The Voyage Home, where Kirk (coming from 2286) says "these people still use money" upon arriving at 20th-century Earth, and says "We don't." when asked whether or not he and his crew use money in the 23rd century. In "The Neutral Zone", Picard tries to explain to cryogenically preserved people from the late 20th century that 24th century economics are quite different and money as they know it is not used or needed in the Federation. In Star Trek: First Contact, he gives a similar speech to Lily.
In other episodes, especially earlier in the in-universe timespan, a monetary unit known as the "credit" is mentioned. At the Federation space station K-7 in the original series episode "The Trouble with Tribbles", set in 2267, Uhura offers to buy a Tribble for 10 credits. In the episode "Errand of Mercy", also set in 2267, Spock estimates that Starfleet has invested over 122,200 credits in his training as a Starfleet officer. In Star Trek III: The Search for Spock, in 2285, while on Earth, McCoy attempts to hire a ship to take him to the Genesis Planet, and is warned it would be expensive and cost many credits; we do not know if McCoy could have afforded this or how much it would cost, since he was taken into custody for breaching the secrecy of the Genesis Project immediately afterwards. And in Star Trek II: The Wrath of Khan, Carol Marcus mentions the Federation's decision whether or not to "fund" the Genesis Project itself, though "fund" means something different in this context as credits are not mentioned. In the Deep Space Nine episode "You Are Cordially Invited...", Jake Sisko tells Quark he sold his first book, but when Quark asks him how much was gotten for it, Jake answers, "It's just a figure of speech." This explains moments when characters have made similar comments (in Star Trek VI: The Undiscovered Country, for instance, when Scotty mentioned having "bought" a boat).
During the film Star Trek Generations, Captain Kirk states that he sold his house some time in the previous nine years, which from Kirk's perspective would be between 2284 and roughly 2290. By the time of The Next Generation, money was considered abhorrent to many members of Starfleet, although in "Encounter at Farpoint", set in 2364, Beverly Crusher buys a bolt of fabric and requests that it be charged to her account on the Enterprise. Two years later, in 2366, in "The Price", the Federation is willing to pay millions of credits for access to a stable wormhole. Additionally, some officers were shown in "Tapestry" to visit casinos, particularly near starbases, and poker is shown on a number of occasions to be a favorite pastime of Enterprise-D crewmembers, though real money is never said to be part of the game. In the Deep Space Nine episode "Explorers", Benjamin Sisko says that when he first entered Starfleet Academy, he rapidly spent an entire month's allotment of transporter credits (which may not be the same thing as 23rd-century credits) on transporting back and forth to his home in New Orleans. He also arranges for his wife's employer to give her a month's paid vacation (emphasis in episode) in "The Changing Face of Evil" (although his wife works for the Bajorans, a non-Federation race). And in the pilot episode of Star Trek: Voyager, Tom Paris makes a reference to having someone "pay his bar bills".