That's if it is equally applied to everyone. Examples, similar to yours, are used as basis of racial discrimination lawsuits when the evidence shows that it is selectively applied to a group of people.
Discrimination is perfectly legal in the US. It is only illegal if you discriminate against someone within a protected class on the basis of them being a member of that protected class. Political affiliation is not a protected class.