Is it possible for an author to sue a fanfiction writer for creating low quality works with high levels of inappropriate sexual references, profanity or other restricted content?
Please refer to My Immortal (the Harry Potter fanfiction) as an example.
Anybody can sue anybody for any reason, the questions is would they prevail.
First, Profit vs. Non-profit is a tax creature that has no bearing on non-tax cases.
Second, quality is a subjective matter, not subject to judicial review.
Third, level of sexual references, profanity and restricted? content, is also not subject to judicial review.
Fourth, freedom of expression (remember the 1st Amendment?) is guaranteed by the Constitution.
So the plaintiff will have to argue something else or be thrown out of court.
I am not as comfortable as the redoubtable Mr Golub about the IP implications. What yiou have described is not according to you a satire, nor a commentary. Depending how much Rowling is in the content, as opposed to your deathless prose, you may have created one or more derivatives of the Harry Potter works, arguable subject to the original copyrights.
That could be infringement. Please consult with a copyright lawyer about these matters.
It is not only possible it has been done. The following is what Wikipedia notes on whether fan fiction is legal.
Fan fiction is a derivative work under United States copyright law.
Some argue that fan fiction does not fall under fair use. The 2009 ruling by United States District Court judge Deborah A. Batts, permanently prohibiting publication in the United States of a book by a Swedish writer whose protagonist is a 76-year-old version of Holden Caulfield of The Catcher in the Rye, may be seen as upholding this position regarding publishing fan fiction, as the judge stated, "To the extent Defendants contend that 60 Years and the character of Mr. C direct parodic comment or criticism at Catcher or Holden Caulfield, as opposed to Salinger himself, the Court finds such contentions to be post-hoc rationalizations employed through vague generalizations about the alleged naivety of the original, rather than reasonably perceivable parody."
Others such as the Organization for Transformative Works uphold the legality of non-profit fan fiction under the fair use doctrine, as it is a creative, transformative process.[26]
In 1981 Lucasfilms Ltd. sent out a letter to several fanzine publishers asserting Lucasfilm's copyright to all Star Wars characters and insisting that no fanzine publish pornography. Lucasfilm did not want the family-friendly aspect of the story and characters to be corrupted, despite the obvious draw that explicit content has for the fans.The letter also alluded to possible legal action that could be taken against fanzines that did not comply. Later that year, the director and legal counsel of the Official Star Wars Fan Club sent fanzine publishers a set of official guidelines. Lucasfilms supported fan publications contingent on their upholding these guidelines.
In recent years, several prominent authors have given their blessings to fanfiction, notably J.K. Rowling. Rowling said she was "flattered" that people wanted to write their own stories based on her characters. Naomi Novik is another author who is supportive of fan fiction: she is a member of the Organization for Transformative Works and began as a fan fiction writer. Similarly, Stephenie Meyer has put links on her website to fan fiction sites about her characters from the Twilight series.
However, Anne Rice has consistently and aggressively prevented fan fiction based on any of her characters (mostly those from her famous Interview with the Vampire and its sequels in The Vampire Chronicles). She, along with Anne McCaffrey and Raymond Feist, have asked to have any fiction related to their series removed from FanFiction.Net. George R.R. Martin, who was selected by Time magazine as one of the "2011 Time 100" and is most famous for his epic fantasy series, A Song of Ice and Fire, is also strongly opposed to fan fiction, believing it to be copyright infringement and a bad exercise for aspiring writers.
Wikipedia has a more extensive article on legal issues with fan fiction.
http://en.wikipedia.org/wiki/Legal_issues_with_fan_fiction
Being a non-profit gives an argument in favor of fair use, but is far from determinative.
Bottom Line: Yes you can be sued. Making semi-pornographic fanfiction is more likely to get you sued. Fanfiction exists at the discretion of the author, as the authors have the resources generally to sue fan fiction authors they do not like and few fan fiction authors have the resources to defend themselves.
In my opinion, "fanfiction" would be a derivative work. And if you souped-up the original work with "high levels of inappropriate sexual references" then expect to get sued. Almost guaranteed.
Also, ignoring the strict letter of the law, I believe you would lose because judges and juries are human beings too. If the law arguably supports a punishment for this type of work, you would get it.
Understand that this does not represent any personal bias on my part against this kind of work, I'm just being practical.
Good luck.