it is not legal, but read what i say next anyway
i am a former emissions inspector, i have done 10+ 4cyl/6cyl to v8 swaps, i also have a v6 to v8 swap in my bronco ii. in 2010 i even called the main testing station on vine st (anonymously) and asked these questions
he said:
no it is not legal, and he cannot tell me "go ahead and do it"
but he said if a person were to ignore the laws and go ahead and do it that they usually do not condemn the vehicle, they will just approach it as "welp, whats done is done"
the rules are normally, it must be:
1) an engine that came as an option in that vehicle for that year (so the ford explorer 4.0 swap into a broncoii with a 2.9 isn't technically legal, but i know 10 guys with that swap, they don't hassle them)
2) the same size of engine or smaller (4.0 jeep to 2.5 ok, but not vice-versa)
3) equipped with all the same emissions controls as would have been equipped on that engine/year
4) same number of miles on engine or less
but he said that so long as you take an unmolested engine (he specifically said that he usually turns away big camshafts, and "hack jobs"), engine management, all emissions controls all from the same model year or newer he will test it and see if it passes
but on paper it is not "legal", it is literally up to what kind of mood he is in, he is an older gentleman, smarter than hell (over the years i have gone in for v8 swap emissions, waivers etc.) he has seen it all and you usually can't pull one over on him. but he is a good guy, not a nazi. if it passes he really doesn't care. so long as you don't walk in there with the attitude of "you are required to pass this" if you do he will turn you away
the biggest part is if it is newer, the fact is that a 2.3l from 1994, has higher emissions than a 5.7l from 1995 due to annually increasing epa restrictions, so basically you could put a big-block 7.4l in place of a 1.0l 4-cyl and it would emit less so long as it was a properly functioning newer engine. that is all that really matters