Harry Potter verse clearly does have rules. But what those rules are, are very hard to pin down because JK Rowling refuses to establish them. Unless of course, she's fishing for brownie points.
But here is the thing. A society that is clearly as racist and Xenophobic as the Wizarding World...