Laws vary by location, but in most places, engine swaps are legal as long as the new engine also meets emission standards for the vehicle's model year. Always check local regulations before proceeding with an engine swap.