It's legal if it's legal, but it's a safety step-down.
The reason is: the old 3-wire connection does not have safety ground. In theory that's only a problem if the oven also malfunctions but it's actually much worse.
While we strive to keep neutral near the same voltage as ground, this can fail - you may notice neutral wires have insulation and that's why. A simple neutral wire break (happens all the time) will float neutral up to 120V, making it lethal, and in theory everything is still safe because we have this SEPARATE thing called ground that is still at 0 volts to ground.
But in 1966 when grounding became required everywhere (we weren't even on the moon yet), appliance makes said "hold on, what about older range circuits that only have 3 wires? We can't make everyone rewire." And they sad "Why don't we just attach the range body to NEUTRAL? After all, those plugs are rarely ever disturbed so neutral is unlikely to fail."
But this fails silent but deadly. The oven light and clock stop working, that's your only hint of a problem.
But they do energize the chassis of the oven at 120V, so randomly at some point you touch the oven and a ground thing and KA-BLAM.
So modern ovens need a separate neutral and safety ground, hence 4-wire socket/plug.
OK, I want that protection. How do I get it at sane cost?
- Open up the receptacle and see if there is a proper ground hiding in there. They outlawed that socket in 1996 but "no ground" cables went obsolete in 1966, so fair chance they used a "3-wire + ground" cable to wire your range. If ground is there just use it.
- Note that if ground goes to a metal junction box, don't unhook it. The receptacle will automagically pick up ground if it bottoms out on the junction box steel. Or add an additional ground wire to a ground clip you clip to the side of the box.
- If they used /2+ground cable, abusing ground as the neutral, that was illegal the day it was installed and should be replaced. Sorry.
- They now have generous rules to allow retrofitting ground. Retrofit a 10 AWG bare ground using any viable route back to the panel, another junction box with #10 ground going back to the panel (water heater), or that bare copper GEC cable going toward water pipes. Do not use water pipes. Use a 4-wire socket with the retrofitted ground.
- Here's a wild one. You can get 2-pole GFCI breakers, they're not cheap. Get one, run only the 3 wires. Install the 4-pin socket but do not connect the ground to anything. Put labels on the socket "GFCI Protected / No Equipment Ground". That's legal.
On the GFCI scenario, the ground must be disconnected at the socket. Do not connect it to neutral in any way, or you could inadvertently create a subtle situation that John Ward discusses here where you get shocked while the GFCI laughs at you. (when John says "house" pretend "range", RCD means GFCI, and pretend John drew a second hot wire).