The law makes it harder to sell votes by making it easier to steal them. The insanity of such a policy is still clearer when one considers that vote-selling is at worst a (benign) symptom of an undemocratic system. Just as the sale of organs does not create the dire situation in which one's organs are less useful than their price, but rather marginally improves while shockingly revealing it, exploitative vote-selling (in a true democracy, votes would sell for GDP/population, but presumably we're taking about America) exposes a fraudulent democracy while fully compensating the seller's loss of electoral power with an increase in purchasing power (the purest form of obedience to "It's the Economy, Stupid"
.
Ironically, the vote's anonymity, which prohibits not only selling but also trading, is one of the reasons electoral votes are so worthless in the first place. The elected face no such restrictions. They trade votes all the time (without which even less would get done than what currently does) and have far greater incentive to sell them. If Gore and Nader voters had traded (the honor system doesn't count), Gore would have won. Instead, Gore voters in safe states and Nader voters in swing states only realized their vote's negligible use-value. Even outside of Electoral College peculiarities, some's political interests are more local than others', and the inability to trade replaces democracy with randomocracy as indifferent votes are weighted equally with others. Compromise candidates, too, would fair better, promoting stability.
Another problem with anonymous voting is that it enables people to harm each other (by proxy) without the natural consequences, and denies them the social benefits of proof that they voted in a socially responsible way. But some call that "coercion", as if to vote were not to select a coercer.