Here is a theoretical scenario.
Let us hypothesize that an official member of the Buffy writing team, let us say Jane Espenson for purposes of this scenario, enjoys her job a lot. So much so that, in the gap between season six and seven, she writes an unofficial story outside the bounds of the televised show but suitable for inclusion in one of the 'Tales of the Slayer' anthologies.
This is, of course, fanfic at that stage, because it has not been officially commissioned.
When the team assembles for the next season she brings the manuscript with her. Finding a suitable window of opportunity when Joss is not daydreaming about 'Firefly' (I told you this was a theoretical scenario!) she shows him the manuscript and says she wants to submit it for a 'Tales of the Slayer' collection.
Still fanfic. (I'm assuming for purposes of the scenario that Joss actually does have creative control over the books)
Joss says "Hey, this is great, Jane, of course it can go into 'Tales of the Slayer'." Suddenly, magically, the story is no longer fanfic. It has been transmogrified into official canon without a single word being changed.
Alternately, Joss is thinking about a way to include Andrew among the crew of the 'Serenity', only glances at Jane's story, sees no mention of Andrew and says 'nope, I don't think so'. The story remains fanfic until such point, if any, as Joss changes his mind.
Now throughout this scenario the story is the same, the writer is the same, and the motivation is the same. The only difference between the fanfic version and the official version is the stamp of approval.
Let us then assume that Jane's sister's husband's cousin's aunt Matter has been a long-time fan of the show, but for a living she writes histories of the Mexican-American War of 1848. While doing fieldwork she comes across a legend in Sonora that reminds her of the Slayer stories. She writes a story based upon the Mexican legend but incorporating the Council of Watchers, the One Girl in all the World bit, etc. Therefore, fanfic.
She shows it to Jane, who recognises it as the most brilliant piece of imaginative fiction since the Epic of Gilgamesh. Jane rushes to work and excitedly shows it to Joss, who (remember that this is purely hypothetical) refuses even to look at it because it is not written by a member of the ME team and does not feature Andrew.
It remains fanfic.
Auntie Matter then goes through the story removing Buffyverse references. This removes some of the logic behind her version of the tale and weakens the structure. It is no longer fanfic. It is, however, of slightly lower quality. Still very good, but no longer superb.
But it is marketable.
All of this, within the terms of the scenario, is undeniable.
Therefore, whatever the moral and legal issues that may apply to fanfic, one thing that must be removed from the discussion is any reference to quality. No work of fanfic, not even the most typo-ridden and incoherent "Everybody's human and Spike Giles is teh hot geezer from Catford, innit, but somehow he goes to school in California" mess on ff.net, could possibly be as bad as the published works of Andrew Harman (labelled as 'in the style of Terry Pratchett', but that's true only in the sense that a Trabant was in the style of a BMW 5-series) or as the worst book ever written; 'Rhinoceros' by Colin Forbes. (The heroes prevent an anti-capitalist riot by destroying the telecommunications system of the entire world to stop the opposition being able to gather their forces. Rather like stopping a mugging by dropping a 15-megaton nuke on New York. It made the UK hardback bestseller lists.)
Therefore if someone wants to criticize fanfic, let them not build straw men. If they want to condemn underage porn fanfic, let them condemn it for being underage porn; not for being fanfic. Don't label all fanfic as poor quality; that is like judging all TV by 'Yuss My Dear' with Arthur Mullard and Hilda Baker. (Note to US readers; you were spared that, as you were spared the Black Death. We got both; and I can assure you that the Black Death was a lot funnier).
And if anyone can point me in the direction of an official 'Tales of the Slayer' story (other than the Ancient Greek one in the first collection) that is even one tenth as good as 'The Cloak of Mist' or as quinara's 'Propugnatrix Pollia' then I'll give my computer to a charity for schools in the Third World. No hyperbole; I really will.