Perfectly legal. In NCAA and NFL, the line of scrimmage sort of disintegrates once someone crosses it. Not so in High School.
I've always wondered why this trick play isn't used more in High School... maybe coaches don't know it:
QB hands off to RB, who runs around corner to right side. EVERYONE is pursuing RB - even those on the left side of the field now go towards the play. NOBODY is on the QB anymore, and NOBODY is on the left side.... so, have the RB throw back to the QB, who then throws to a wide-open receiver on the left side. And if too many people are around the RB, just have him run, don't pitch back. I bet, after practicing this a lot, it would be a very effective weapon.