EV producers like Tesla and Rivian have boosted their profits by selling emissions credits to makers of gas vehicles.