That's the whole point of the legislative system. Morality may determine what laws get made/passed, but they aren't the same. That's why this can be morally reprehensible but still legal. And just because it's not unconstitutional doesn't mean there aren't state or local laws that don't cover this. Even the article states that several states have constitutional provisions that cover this.
EDIT: Changed legal to legeslative to differentiate between the judicial system.