Is it considered unethical to pay participants differently based on some quality?
I don’t see on what grounds anyone could regard this as unethical, but one might legitimately wonder whether paying the two groups of participants unequally might inadvertently create a bias that would compromise the integrity of your conclusions. After all, your research is presumably premised on the assumption that the participants from the two groups are both fairly typical representatives of those groups. But if you pay participants from one group $10 and those from the other (for argument’s sake) $5000, the participants you’re likely to get in both groups might differ in some ways that you didn’t expect - for example, the lower-paid participants might be people who are more motivated by an altruistic desire to help scientific research than the higher-paid participants

Whether this is a genuine concern or not depends on the difference in the pay and on the precise nature of your study, but it’s something to think about.