The black hats are actually a small percentage of online users, but they cause a disproportionate amount of trouble and receive a disproportionate amount of attention.
Take spammers, for instance. Of all the email users on the Internet, a very small percentage of them are true spammers. The definition of spammer I'm using here is someone who sends a large volume of unsolicited messages to an unqualified list of recipients. But spam gets a lot of attention because it affects every "legitimate" email user in the system. At the same time, a tremendous percentage of the email that flows through the system is spam, most of which is a giant waste of bandwidth because it will be thrown away or blocked.
If everyone hates spam and it is largely useless, why does it persist? Because it is difficult to identify these people. (Of course, it is also because some idiots actually respond to it.) Spammers operate anonymously and with impunity.
As a society, we define laws that formalize our definition of ethical behavior. Behavior that is inconsistent with these laws is "criminal." But obviously, laws and the penalties for breaking them don't stop crime. At the core of every criminal act is the believe that you will "get away with it." That belief is given full reign in an environment where you are anonymous.
Anonymity acts like a switch in people who harbor the desire to victimize others. Even people who otherwise live their lives as responsible citizens expose their dark side when given access to an environment where they can act without consequence.
You can often recognize these victimizers by certain attitudes that strongly represent the criminal mind set: "If you are stupid enough to let me get away with this, you deserve to be taken advantage of" and "It's not illegal if you don't get caught." I've known people who actually say these things and believe them, but I certainly don't trust them.
So what's the key to "good behavior" on the Internet: Don't do anything you wouldn't be willing to sign your name to. Granted, many people would have no problem signing their name to their bad behavior, but at least you know who they are and can avoid them if your ethics disagree with theirs.
After all, our laws are just an expression of our national conscience. If those laws disagree with your personal values, you have the right to dissent. Laws can change with the times.
In the meantime, the Internet has given us a medium of anonymity that makes it easy for its users to behave badly, largely without consequence. As a social experiment, it raises some interesting considerations for humanity as a whole. It shows what happens when no social or legal pressure exists to "keep people in line."
What do you think would happen if everyone who used the Internet could be positively identified? If everything you did had your photo next to it? Would you be less likely to send that spam or stalk that person in Second Life?
I'm guessing you would.