It is complete legal. Remember, a company is not required to give raises at all--employers could, for example, choose to never give anyone any raises, even cost of living ones. If employers choose to give raises, they can decide how much, when, to whom--and therefore, who does not get raises--why, etc.; you company is therefore free to give raises to people who are not maxed out in their pay grades, if it likes.