He did.
Note that both the Democrats and Republicans are looking into writing a law to disallow that going forward.
If they need a law… it was legal.
(And, in fact, was attempted by Democrats in 2016 and 2004…. But don’t let the propaganda convince ya!)
There was an ad campaign in 2016 begging electors to change their votes.
That would basically be to repeal US Code Title 3 Chapter 1.
-PJ