Ninty shuts down everything, whether it's gonna be sold or not, as long as it's one of their main franchises. That means if it's a free game based on something even Ninty doesn't care about anymore, only then will it be allowed to stay alive. It's like they are doing it just to get more money, rather than protect their IPs...
As for Sega, they have shut down a fair few fan games, but if the games are based on old ones and free they don't bother. For example, there's the Sega Rally Championship based game that has about 25 cars (compared to 2 the normal one does) and twice the maps and they have allowed it to stay alive for a decade now without any problems and even one of the devs of the original said he liked the fan-made one more!