This is state-by-state. Here in Wisconsin, it’s totally legal. It’s the logical complement to the fact that our law doesn’t say the left lane is for passing, rather “Slower traffic, keep right.” If you’re passing someone on the right, it’s because that other person didn’t follow the rule of keeping right.