The CDC never had any official position that masks don't work. In March of 2020, the CDC official position was that people not working in healthcare or caring for the at-risk do not need to wear masks. in the same announcement they said
"Facemasks may be in short supply and they should be saved for caregivers"
in other words, masks work, but we need to save them for where they will do the most good.
however, the Trump admin's messaging was an unholy pile of hot burning garbage, so one could be forgiven for thinking the official recommendations were that masks don't work.