Famously, "50 Shades of Grey" started out as a Twilight fanfic. The author later pulled out all of the Twilight-related stuff and then it was free and clear to publish as their own work. Given how much money 50 Shades raked in I would imagine there's been some legal scrutiny there from various sides.