Which is not really a problem if the legislature considers someone committing the former to be more dangerous than someone committed the latter.
It is a problem if the legislature is wrong. For instance, if they have been swayed by appeals to emotion or appeals to popularity.
As as example, hate crimes legislation doesn't usually include crimes directed at left-handed people because of their left-handedness. I suggest that the reason for this is that there isn't a significant amount of crime directed at left-handed people. Thus, this type of prejudice, if it occasionally occurs, is not as serious a problem and is thus less important for the legislature to address.
Heh - it seems victims of minority crimes are being discriminated against - "sorry Bob, but we can only get six months for your attacker because his motivations aren't widespread enough to warrant being called a social problem that needs special attention.". Just because there is a greater amount of a certain crime - it doesn't mean it should be punished more seriously than an equal crime committed with uncommon motivations. Creating this kind of law has noble intentions, and it might even go some way towards addressing the social evil that is being combated - but we shouldn't fall into the trap of thinking that it's the best or even only thing that can be done about it.