The Iowa Supreme Court last month ruled that it was legal for a dentist to fire an attractive female dental assistant because she posed a threat to his marriage. The case raises some interesting questions about property rights in a free society. Although certain employers are no doubt scoundrels as human beings, the government shouldn’t regulate their hiring or firing decisions—the market has built-in mechanisms to appropriately reward or punish them.

Reading the story of the dentist, it seems he won’t be up for any Man of the Year awards. According to the Huffington Post:

[The assistant], 32, worked for [the dentist] for 10 years, and he considered her a stellar worker. But in the final months of her employment, he complained that her tight clothing was distracting, once telling her that if his pants were bulging that was a sign her clothes were too revealing, according to the opinion.

He also once allegedly remarked about her infrequent sex life by saying, “that’s like having a Lamborghini in the garage and never driving it.”

Assuming the story accurately summarizes what happened, it’s safe to conclude that the dentist is a jerk and that his assistant was the victim of unfairness. Yet this alone doesn’t mean she should have won her lawsuit seeking to be reinstated at her old job. It’s not (and should not be) illegal to treat people unfairly per se. Unless stated explicitly in the original contract, workers don’t have a right to their jobs. It is the employer’s money, to be spent as the employer deems fit.

To see the principle involved, switch the context away from employers to consumers. If someone has been going daily to a particular Japanese restaurant for ten years straight, he always retains the right to suddenly stop going altogether, with no notice given. This is true even if the owner of the restaurant had come to depend on that business and made business decisions assuming the customer would continue spending money as he had done for the previous decade.

Now suppose that in this scenario, the restaurant owner filed a lawsuit, demanding that the customer prove his motivation had to do with finding a better restaurant—rather than prejudice against Japanese people. Such a case would be laughed out of court. The principle would be straightforward: it was the customer’s money to spend as he pleased. No matter the precedent set by his earlier behavior, and no matter the inconvenience or even genuine financial hardship his sudden change in spending would impose on the restaurant owner, the customer doesn’t have to explain his motivations to anybody. By the same logic, then, one could defend an employer’s right to spend his money as he pleases. If he changes his mind after ten years and fires an employee, that is his prerogative; he doesn’t need to explain himself to a judge.

Turning from rights to practical considerations, economists have long argued that a free-market economy contains automatic mechanisms to reward or punish employers based on the fairness of their decisions, when “fairness” is defined in a certain way. When casting the role for Abraham Lincoln in the new Steven Spielberg film, it was obvious that they were looking to hire a white male—no one else needed to apply. Yet this is hardly what people mean by “gender or racial discrimination in the workplace.” Another obvious example is the racial composition of professional sports, where black men are represented far more than their proportion in the population. Here too, most people wouldn’t consider this racial discrimination.

Now consider an example where the consensus would fall, but only slightly. It is undeniable that if one looked at the staff at a busy downtown restaurant, the greeters at the front door and the wait staff would be more physically attractive than the people working in the dish room. It would be clear that this wasn’t a statistical fluke: whoever made the hiring decisions was clearly putting young, pretty girls where the customers would see them. Although some people would consider this an example of “bad” discrimination—perhaps the kind to be outlawed by the government—most Americans wouldn’t object to this type of practice. This isn’t what they would have in mind when saying the government ought to punish employers for discrimination in the workplace.

On the other hand, if there were an employer looking to fill an accounting position, and of two candidates—one black, the other white—the employer hired the white candidate because he was white, then most Americans would say this is the type of situation they want penalized.

Putting our finger on the precise issue, we can say that the vague sense of injustice is ultimately driven by employment decisions based on criteria that don’t affect the bottom line of the business. In other words, if the employer makes a decision based on personal characteristics of the employee (sex, race, religion, age, etc.) that are unprofitable, then this is exactly the type of thing that the government should be punishing.

When it comes to the “pay gap” between men and women, the differences begin to melt away once other factors (such as marital status, educational attainment, years in the industry, and inherent danger of the job) are taken into account. One huge difference between, say, a 23-year-old married woman and a 23-year-old single man who are otherwise identical is that the former is more likely to leave her job (either permanently or just for a year) because of a child. Yes, it’s possible that the 23-year-old single man will do the same thing, but it’s not as likely. So when deciding on which candidate to hire and on whom to spend perhaps thousands of dollars training, the firm rationally is more likely to hire the man, or, if the female candidate is to remain competitive, she will have to work for a lower salary.

These types of considerations strike many people as crass and unconscionable, but they are undeniable facts of business, just as surely as the fact that restaurant patrons would rather be greeted by a pretty young girl than a 55-year-old ugly man. If people wish to retain their right to spend their money as they see fit in their roles as consumers, then they should grant business owners the same freedom. The forces of market competition will give the producers the right incentives to make truly business-oriented decisions. These incentives won’t ensure perfection, to be sure, but they are much better calibrated and swift than relying on government courts.

Robert P. Murphy is author of The Politically Incorrect Guide to Capitalism. His blog is Free Advice. Follow him on Twitter.