Drill off VIN tag. Attach VIN tag to "new replacement part" body. If you like, add bits from the donor car that happen to have identifying numbers on them.
Done. And legal.
All we've done here is replace a lot of damaged parts with new parts, Officer Dibbles :).