Yes, it is legal, but not all plans allow incoming rollovers. Fidelity does, vanguard does not. Not sure about others.
Unrelated, but since you probably recently crossed $250k, make sure you're filing form 5500 for your 401k. There are some nasty penalties if you don't that keep going up the longer you wait.