The 1941 law is intended to prevent businesses from driving others out of business by selling goods at prices below cost. The goal is to protect consumers, because a company that wiped out competitors could then charge any price it wanted.
In this particular case, it prevents Wal-Mart to sell generic prescription drugs for $4, which have to be charged at least $9. Not surprisingly, independent pharmacists are fighting against a change in this law, given that they sell these drugs for $25...
So, we have a law that is supposed to prevent a future monopoly by instituting a cartel.