I'd bet that such action is already prohibited by military law, just as if one were to show any other kind of favoritism. And there's always that "conduct unbecoming of an officer" catch-all to snare the higher-ups.
It probably is. The issue here is that such laws haven't been enforced recently.