If a fan game is just loosely inspired by a commercial game and every game content (software, graphics, sound wise) is created new, than I don't see many problems.
http://en.wikipedia.org/wiki/Sweat_of_the_brow Of course trademarks of any form cannot be used, but for the new work even the fans can claim copyright. The only problem is to define the thin border where something is just a plain copy of something or it is a creation of its own. Especially parodies allow to easily use a lot of original ideas and still being seen as new creation.
I would say, if fans think independently about a game, create the content independently and just let themselves inspire strongly by an existing game, there is not much to worry about. After all, commercial games also are influenced by their predecessors. It's natural.
Just don't copy whole parts 1:1.
You always face a certain legal risk to be accused of violating copyright, whatever you do. To protect yourself, maybe just found a small company/society before and develop the game in the name of this company/society. Just in case, hostile lawyers close in you can sacrifize the company instead.
But by far the more difficult thing is to actually get the game done, always. ;)