Well, I can explain to the best of my understanding, but I'm not a lawyer, so don't take this as legal advice.
Sonic the Hedgehog is a trademark of SEGA. A trademark is a legal way of saying that they own the name and design in a certain business. For example, if you opened a restaurant and named it "McDonalds", McDonalds could sue you to change the name because they have the trademark on the name McDonalds for food places. However, the Sonic restaurant chain can use the name Sonic because SEGA's trademark only applies to video games and other related content that they registered for. All fan games by definition are trademark violations, because they are video games using a company's trademarked character.
SEGA also owns the copyright to the Sonic franchise. Copyright is a legal way of enforcing your ownership of content that you produce by allowing you to determine who has authority to make copies of it. If you go draw a silly doodle in MS Paint, you now own the copyright to that silly doodle and you can sell it and if someone is making copies without your permission, you can sue them for copyright violation. Copyright applies not only to the entire work, but also various parts of the work as well. SRB2 is a copyright violation because we use various art assets and sound effects from the Sonic franchise without permission.
SRB2's code is based on Doom Legacy, which is a source port of Doom. Doom's code is licensed under the GPLv2, an open source license. The basics of that license are that the code is open source and any derivative works must also remain open source. This is why SRB2 itself and any mods of SRB2 must provide our source code, and why you're allowed to modify SRB2's code and release your own edition without any input from us or the developers of Doom.
SRB2's resource files (srb2.srb, zones.dta, etc.) are not part of the GPL, however. They are a combination of our own original content and the copyrighted content of others (SEGA's sound effects, for example). Just because the code is open source doesn't mean that the rest of the game is, and Doom is actually exactly the same way. While Doom itself was open sourced a long time ago, Doom's IWADs continue to be copyrighted and you have to pay id for them. This is where we, as the developers, hold copyright, as the original content we created is still our original content and copyright applies to it.
So, putting all of this together, what does it all mean? Well, first off, since we're a trademark and copyright violation, SEGA could shut us down at any time they want to by exercising their intellectual property rights. This is why we're so adamant about not having money involved in the SRB2 project, because we're doing this as fans as a hobby, and the instant you start taking money, then it becomes a business and it's very much in SEGA's interest to shut down people making money off of their property.
Second, and unrelated to the first point, we own the copyright to the original content in SRB2's resource files, and therefore can still disallow people from copying it without permission. Obviously, as a freeware game, we don't enforce such copyright restrictions and allow people to copy and redistribute it as much as they want, with two exceptions: the game files cannot be modified (leaving credits intact, for example) and no money can be charged for the files. This is how we can say "This game should not be sold!" and have it be legally enforceable, because we still own the copyright to parts of the game that are included in the package.
In practice, all of this wall of text never comes up in reality. Basically the only times we've had to enforce our copyright on others was to shut down shady eBay freeware resellers who were including our game on disks that they were selling. Unless you're trying to sell the game like our shady OP was attempting to do, our copyright doesn't affect you at all.