Most states dont like when a car is "retrofitted" with an older engine, even if emissions are better (tried to swap an EFI engine into a carby car but couldnt cos engine was 2 yrs older than original)
You'll find if you looked into that it would have been legal.
You can put a 1990 motor in a 1998 car if the emmisions expelled by the 1990 motor exceed that of the 1998 motor.
Many people have legally put 1990 1UZ's in late 90's cars because the 1UZ has very low emmisions.