In his book Discipline and Punish
, Michel Foucault talks about how, in every society, there is a "margin of tolerated illegality"--a gap between what is considered criminal and wrong, and what is considered merely illegal. This gap is often a site of conflict between the power of the state and the resistance of the people, arising from clashing value judgments.
During the Prohibition Era, for example, drinking fell within the margin of tolerated illegality for large sections of American society. It was illegal--but people did it anyway, because it wasn't considered wrong. And eventually, the law was changed (back) to reflect this judgment.
I think fan fiction falls within this margin. It is illegal--but since it causes no obvious harm to anyone, and may actually benefit the copyright holder, indirectly, it's not considered wrong--at least, not by its writers and readers.
The outright piracy of copyrighted material also falls within this margin, for many people.
On the issue of fair use--from what I understand, this post is an example of what fair use actually entails. I quoted Foucault's work, while giving proper attribution, instead of presenting the author's ideas as my own. I'm not sure what Foucault would have thought of people writing fanfic based on his work.