Well, it's not exactly a ban. It was an executive order by the governor (not a law or ordinance passed by the legislature) that directs the Air Resources Board to look at regulations on how to make it happen. And it is targeting the sale of new vehicles, not the use of existing ones. At least, that is the wording.
A similar threat happened with the move from 2-strokes to 4-strokes. Essentially the EPA said that OEMs did not have to stop making 2-strokes, but if they did, and those bikes were found being used on public lands, the government had the right to forbid that OEM from ever selling bikes in the USA again. That rule is what lit a fire under the manufacturers butts to make the move to the unexpectedly very loud 4-strokes. The move to electric is slightly different, although it is California that is once again leading the charge (pun intended!).