|You know it makes sense|
This is a long-standing matter of debate. It's definitely stated that money doesn't exist and economics are different. Captain Picard says more than once that they work to better themselves and others. (See also the page on other questions of what the Federation is like.)
It's possible that the Federation is what is called a "post-scarcity society". What if material goods were available to anyone who wanted them? The replicator would seem to make this possible. The most common reason for work—i.e., to get the money for what you need or want—disappears. Some have objected that even if you can have any material object, there are (for example) only a limited number of tickets for the World Cup final, or apartments in the centre of Paris, so there is still some competition; but it's hard to believe that many people would seriously work in the modern sense for these, let alone that a whole capitalist or money economy could be based on such things. The sort of jobs people want to do as an end in themselves would continue: for example a lot of scientific and academic work, though we can predict that the administrative side of academia will disappear—no more money or hiring issues, so academics and scientists would have little reason to defer to people telling them what to do. It would be easy to secede and start your own outfit, just as in the early days of medieval universities when the scholars were not tied down by physical plant. Also the arts, callings such as medicine or religious vocation, and of course Starfleet itself. There could also be things people did for glory and status—this would overlap with other motives; for example sports might occupy both people who just enjoyed them and people who wanted the attention of being famous. (See below for more on status as a motive.)
There is however an alternative possibility: work is still necessary but now everyone is doing it in order to better themselves. This vision of society has been around for some time. In the 19th century William Morris wrote a Utopian novel News From Nowhere, about a future in which work is an end in itself that people enjoy. Marx believed that history would reach a similar end-point, "after labor has become not only a means of life but life's prime want" (Critique of the Gotha Programme) but didn't say much on the subject. However Lenin expanded on it a bit in The State and Revolution. After the revolution, there would first be a "dictatorship of the proletariat" in which you would receive a certificate for your labour enabling you to get the equivalent goods. Lenin warned that "we must not think that having overthrown capitalism people will at once learn to work for society without any rules of law". But then there would be a higher stage, when all this is left behind, people work freely, and the rule is "From each according to his ability, to each according to his needs".
We don't get to see a lot of the world outside Star Fleet in the earlier series. Starfleet itself is not much help. (Even in the present day, capitalist economics are not necessary for the internal relations of a naval crew at sea, or an Antarctic expedition.) However there are miners, who seem to be motivated by some sort of gain rather than enjoyment. Star Trek is deliberately vague about them; they're useful for stories but it's hard to fit them into the utopian future. Also apparently there are itinerant Vulcan traders ("Errand of Mercy", TOS) but this category seems to have been invented for the plot. There are also cases where money pops up: for example in Star Trek 3 McCoy is told that chartering a ship will cost a lot, and he says that he has money. (In DS9 Quark's bar is obviously part of a money economy but the space station is a cross-cultural meeting place.) In most cases however it seems likely that these are transactions with people outside the Federation. However, that raises another question: where do Federation citizens get this money from? Does the Federation give you an allowance of money for such purposes on request? Or do citizens acquire money by economic activities involving non-Federation societies? That would be a rather shady activity, possibly illegal, certainly a bit anti-social, but it would not matter too much if it remained marginal, which it probably would if the vast majority of people get everything they want free. We do see signs (such as Star Fleet officers' indulgence in Romulan ale) that they are a bit relaxed about some of the rules when well away from Earth.
It has to be said that TOS does not present a clear picture on the issue, and in fact rather tends to suggest that some sort of money economy is still operating. My impression is that the non-money economy was part of Gene Roddenberry's vision, but like a number of other things in his vision, not actually represented much in TOS as it was in fact made. In "I, Mudd" (TOS) Harry Mudd's crimes have been those of a capitalist economy. In particular he had been selling patents without paying royalties. Mudd claims that he did this as a defender of the free enterprise system. Obviously, this is Harry Mudd making excuses, but what free enterprise system? In "The Apple" (TOS) Kirk rebukes Spock for putting himself at risk to save him, asking "Do you know how much Star Fleet has invested in you?"—to which Spock of course immediately starts citing a figure. But the mention of money is not significant; the point is about Kirk and Spock. TOS simply does not fit the later "canon". Of course, we can retrospectively work out how it can be fitted in, by ingenious suggestions, and this is quite fun, as long as we realize what we are doing.
Back to Morris's News From Nowhere, where everyone is happy to work. Morris did not suggest that factory workers would become happy factory workers. His Utopian vision is of a de-industrialized England where work is a matter of arts and crafts. The Federation economy might be a bit like this, with no need to do boring jobs.
More significantly, there are apparently restaurants, cafes, and bars on Earth with private proprietors. For example, Tom Paris's favourite bar in Marseilles, and Sisko's father's restaurant in New Orleans. Perhaps they do it for love; it isn't explained. However, Captain Picard noted ("The Neutral Zone" TNG) that material wants no longer exist, so evidently you don't have to work. Perhaps it's like a universal income scheme, with people doing something in the way of "work" as they choose. In "Non Sequitur" (VOY) Tom Paris is in an alternative reality "a loser and a drunk", someone who has let himself down. The Federation is not heaven; it's quite possible to waste your life. But presumably you could spend your time surfing.
In the film First Contact Captain Picard states that "The acquisition of wealth is no longer the driving force in our lives. We work to better ourselves, and the rest of humanity." What is the driving force, then? It seems to be either idealism or the desire for recognition. Running a restaurant, or making wine, both of which we see, might be ways of bettering yourself. Chris Farnell comments described the restaurant-type jobs as "Scarcity-era cosplay". I would imagine you would have to be really into cosplay to chop vegetables in a restaurant, but hey, whatever reverses your polarity. However, consider Cosimo's coffee shop ("Non Sequitur", VOY). If the replicators and what-not are doing all the background work, you would be providing an enjoyable social environment, a social centre. For a sociable person it could be fun. Maybe this is what Picard means by "working to better ourselves"—spending your time in service of others. (Chris Farnell also noted: "We know the Enterprise D has bartenders and waiting staff, but that makes sense - if you don't fancy your chances as a redshirt or don't have the grades, waiting tables on the Enterprise is a neat way to see the universe." (Den of Geek site)( In "Future's End," (VOY) a time-travel episode, a 1990s person comments to Tom Paris that "You're so dedicated, you know?—like you care about something more than just your own little life." He responds, with some puzzlement, "Is that so unusual?"
It has often been suggested that Star Trek seems to deal with people who have successful lives—getting into Starfleet is clearly competitive—and that we don't know what life is like for ordinary people. This is not entirely true, as we have seen. One could argue that a coffee-shop proprietor or a wine-maker must be rather special people, but do we know that? Maybe everyone (if they want to) can find something interesting to do.
In "Author, Author" (VOY) the Doctor is having his holonovel published by a publishing company, who are prepared to get into a rather nasty dispute with him when he wants to delay release. The story proceeds as if it were a business in the present-day money economy. It's hard to see how this makes sense in terms of what we've been told: a moneyless publisher might exist as a distribution service, but they are behaving as if there are profits at stake. But it's necessary for the story, and so the episode carefully avoids ever raising the issue. As Tom Paris points out: "This isn't real life, Tuvok. It's fiction. Don't get so caught up in logic." A logical problem you don't notice is not a problem.
At one point in DS9, Sisko recalls how he was homesick when he first went to Starfleet Academy (in San Francisco), and went home to New Orleans each day for the first few days ("Explorers", DS9). Jake comments that he must have used up a month's "transporter credits". This could suggest a system where some resources are still scarce enough that private individuals can't have unlimited use of them, but that these are distributed equally rather than bought and sold. This might also provide an answer to the question of inherently limited things such as tickets to the World Cup.
Other species do seem to have money economies, especially the Ferengi. Logically this would be more consistent with the "enjoying work" version than the "post-scarcity" version. However, it's worth noting that in the present day some rich countries have got richer without any of the benefit going to the mass of the population, so perhaps the other societies simply lack the egalitarian politics to distribute their resources.
One nagging question arises from TNG, about those interminable poker games: what are they gambling with, given that money doesn't exist? If they don't have money, are the chips just points? In Voyager we see examples of wagers of unwanted routine responsibilities, which is possible but rather negative. Incidentally, the poker games are an example of the way TNG sometimes seems more specifically American than TOS. Not everyone plays poker, especially outside the United States, and I preferred the more open camaraderie of the TOS recreation room. The poker games are often interesting because of the conversation, but the poker itself is tedious for many viewers. In TOS they were often playing 3-D chess, but they didn't bore you with the details of the game.
Of course, from a science fiction point of view one could argue that society may be so different in a few hundred years that our categories of economics don't apply and the answers would not make to sense to us at all. However Star Trek is not really that sort of SF. It uses a recognizable human society in order to think about a variety of issues.
Something else to remember is that although human beings may have got past the desire for wealth, they don't seem to have got over the desire for status. This is very visible in Starfleet. In "Tapestry" (TNG) Captain Picard finds himself in an alternate reality where he is an unremarkable junior lieutenant, and he immediately wants to start climbing the ladder. Of course, he says, it's about realizing his potential, but it's striking what a low opinion he seems to have of the sort of role most of his crew fulfil. (See The Militarization of the Federation.)
 The militarized academia shown in ST would recreate the sort of control structures academics generally do not want, and which the Federation economy would seem to make unnecessary, which makes it seem rather improbable. Perhaps Starfleet can command greater resources than civilian universities. See The Militarization of the Federation. [Return]
 These stages are often called "socialism" and "communism", which causes confusion because Lenin's party adopted the name "Communist" but named its state "the Union of Soviet Socialist Republics", while "Socialist" was used as the title of the non-Communist socialist parties in Europe. [Return]
 Interestingly, Harry claims that "knowledge should be free to all"—again, of course, Harry Mudd says whatever suits him, but his viewpoint has serious supporters. Intellectual property led to many needless deaths from AIDS in Africa due to initial insistence on intellectual property rights, for example. More recently, the west has refused to waive patent rights for Covid-19 vaccines.[Return]
 This is the case for Star Trek, but I would argue that attempts to find explanations for the inconsistent settings in the Chronicles of Narnia undermine the mythical content. See The Order of the Narnia Books. [Return]