In the latter reference we find the origin of the term: Alignment in D&D originally referred to which side in a conflict a character chose! Chainmail, the miniature wargame from which D&D descended, provided an order of battle dividing all creatures into "Law," "Neutral," and "Chaos." These were factions within the wargame, just as in a wargame about World War II there would be "Allied," "Neutral," and "Axis" factions. When Chainmail individualized to D&D, the individual character's choice of a faction became known as his "Alignment," as in indicating which of the warring factions the character had "aligned" himself with. The only suggestion of a moral context is seen in the fact that presumably pleasant creatures like treants and unicorns were said to be aligned with Law while the likes of evil high priests, vampires, and orcs were said to be aligned with Chaos.
Why did Chainmail and D&D use Law and Chaos to describe the warring factions? Many people mistakenly credit this to Michael Moorcock and the Elric series, but the origin actually comes from Poul Anderson's classic Three Hearts and Three Lions:
[He] got the idea that a perpetual struggle went on between primeval forces of Law and Chaos... Humans were the chief agents on earth of Law, though some of them were so only unconsciously, and some, witches and warlocks, and evildoers, had sold out to Chaos. A few nonhuman beings also stood for Law. Ranged against them were almost the whole Middle World, which seemed to include realms like Faerie, Trollheim, and the Giants - an actual creation of Chaos. Wars among men, such as the long-drawn struggle between the Saracens and the Holy Empire, aided Chaos; under Law, all men would live in peace and order and that liberty which only Law could give meaning. But this was so alien to Middle Worlders that they were forever working to prevent it and extend their own shadowy dominion."
A similar primeval struggle seems to show up in almost every game or genre, representing the war between civilization and barbarism, Western "white hats" v. "black hats," and so on. It is the implicit alignment system of both Villains & Vigilantes and Marvel Superheroes and pretty much every other superhero game. As a system, it's exceptionally simple to define, as all it really requires is being able to identify two competing sides that a character is fighting for (if not willing to die for any side, the character is neutral). It maintains the sense of grand struggle that is provided by an over-arching alignment system, a sense that the character's decisions are part of something larger than himself. And it achieves all these goals while maintaining maximum flexibility for the player characters to develop their personalities without concern that they'll violate their alignment.
There are two downsides to "alignment as allegiance" system. The first is that there has to be some sort of existential conflict within the campaign, within which characters give steady allegiance to one side or another. It would be hard to use alignment as allegiance in Cyberpunk 2020, for instance (everyone's alignment would just be "Self!"). The second is that the system does not provide any role-playing guidance for how the character might behave. For instance, despite their vast differences in behavior and code, "alignment as allegiance" puts Superman, Batman, and the Punisher all on the same side (Hero).