An “ex post facto” law is one where the crime is designated after the act, thus making the prior act now illegal. The easiest to explain are drug laws. Cocaine, pot and many forms of LSD were once not illegal. Once the drugs were classified illegal, people could be punished for once legal behavior. Possibly closer to home, the federal government once did not get involved in state speed limits. When they wanted criminalize speeds over 55, they threatened to without highway aid until states buckled and criminalized and enforced those limits. Let’s not forget Prohibition.
The act of criminalizing such behavior and then punishing people for the behavior which they previously legally did is always seen as over-reach by prosecutors, some whom are and were zealous in their actions. Sometimes people had some remnants of the now illegal items, and they went from law abiding to criminals overnight.