The fact is that the demand for art (as a Veblen Good) far exceeds the supply, and dealers are not the most scrupulous of people. The last art dealer in a chain of ownership in a forgery is always very angry about the deception and the damage to the art world yadda yadda - because s/he has had to return the money from that sale and suffer the reputational damage of having been fooled, although that is not so bad, as authenticators are contracted in and the dealer will get sympathy from fellow dealers plus some free publicity. So the angst is more about opportunities foregone than a significant loss in most cases. Between the forger and the last dealer in the chain there are usually several others who did very well for themselves, everyone knows this, and nobody talks about it.
Here's how the forgery market works. It may sometimes be a previously unknown painting as in the example of the fake Leonardo from this article, but more often than not forgers produce a 'lost' painting - one that is known to have existed at some time but has since disappeared. It may have been destroyed, it may be owned by someone unaware of its true value who thinks it's just a pretty piece of junk, it may have been stolen (but they're usually hunted for), it may have been forgotten about in an old disused building, or it may have been painted over by the original artist who didn't think it was that great and either hated it or was too broke to buy a fresh canvas, both of which are common occurrences. It's known to have existed from photographs, or from letters, or because it was painted in another painting, like this example: https://www.wikiart.org/en/georges-seurat/the-models-1888 in which Seurat quotes his more famous painting Dimancha a la Grand Jatte.
Every famous artist has a catalogue, which is the record used by historians and dealers to index everything the artist is known to have ever produced, its size, materials, special features (eg if it has a handmade frame or a big wine stain on the back of the canvas or whatever), date of origin, associated paperwork such as a bill of sale, current location and so forth. The catalogue includes available details of lost and missing works and to be entered in the catalogue every work must be authenticated by a professional who knows the artists' work, history etc., and knows all the different things to look for. Think of it as a bit like a blockchain for art. Now, authentication is necessarily subjective, although the technical methods are always improving (spectroscopy of various kinds, cross-references with other pigments known to have been preferred by the same artist, stroke analysis and so on). Once something is authenticated it can be sold, and I'm sure you don't need me to sketch out the various economic incentives in play: if not, consider the sale a few weeks ago of a previously unknown painting by Basquiat that solds to a Japanese collector for $110 million.
A great deal of the value of a painting is not only in the art work itself but in the story of the painting which is what gives it cultural significance. Art dealers are marketers and like all marketers they specialize in finding suppliers, matching them with buyers, and crafting a narrative that will arouse the buyer's desire. I cannot overstress the importance of this. The art value of a piece consists of its aesthetic impact, maybe its representational accuracy (much less important since the invention of the camera, for obvious reasons), and its historical interest as a reflection of the conditions under which it was produced. Articulating these factors is the creative contribution of the dealer.
For example, here is a painting by X - maybe you like it, maybe not. Here is the same painting, painted by X in the last year of her life. Oh, that's sort of interesting and tragic. Here is the same painting by X, painted in the last year of her life before she died of AIDS. Oh, that says something about both X and the times she lived in. Here is the same painting by X, painted in the last year of her life before she died of AIDS, because she could not afford medical treatment for her condition. Oh, very tragic, now you're sort of emotionally involved, aren't you? Here is the last painting by X, painted in the last year of her life before she died of AIDS, for which she could not afford medical treatment because her country was subject to sanctions and only way she could have got treatment was to leave the country, oh my god, that poor woman. Here is the same painting by X - who was so short of money that she used her own AIDS-infected blood as the background color for the image...is it not imbued with tragedy? Does it not somehow breathe with the rapidly diminishing life of the artist herself? Whatever image you had in your head at the beginning of this paragraph, you feel differently now, don't you? Maybe saddened, maybe contemptuous, maybe disgusted, but the act of imagination has changed you.
This is the difference between craft and art: the artist spends themselves in putting gobs of paint on canvas, strikes of chisel on stone, notes in a composition, words on a page, arrangement of detritus on a dais, to evoke some feeling in you that you have have never had before, that you may feel more fully alive.
The dealers, then, are kinds of artists themselves; they take a work, of lesser or greater power, and some facts about it that sketch its provenance, and from these they create a rich tapestry of feeling and cultural significance. And in a world of mass and increasingly automated production (a revolting case in point: https://www.nextrembrandt.com/) it is this uniqueness and the air of historical significance that attaches to it that exemplifies true scarcity rather than the artificially induced kind. Our economic thought is fundamentally erected upon a rapidly eroding foundation of scarcity, and so, paradoxically, it is only through an increase in the supply of scarcity that we can mop up the oversupply of wealth that threatens to drown the system in the signifiers of its own abundance, and wash away the power structures we have erected thereon.
I put it to you, then, that forgers are the greatest artists of all, for they create not merely the canvas but the dream of meaning that surrounds it, and this is why they are decried as wicked and dangerous and put in prison: because if the public were to learn how to dream their own dreams of meaning, what other upheavals might result?