There’s a difference people are missing in the examples given above.

If a law is declared unconstitutional, that means that, despite the fact it was on the statute books, it was “not the law” in a more metaphysical sense – it was contrary to what the Law of the Land holds to be valid law. I.e., if the God-fearin’ City Council of Christian Falls, TX, makes it a criminal offense not to go to Church come Sunday mornin’, that’s not a valid law. It falls afoul of the establishment and free exercise clauses of the First Amendment (technically of the Fourteenth Amendment, but I’ll let a lawyer explain that one). It is not a valid law under which American citizens can be prosecuted in the eyes of the courts. As noted, people arrested, charged, convicted, and sentenced under an unconstitutional law may have to take positive action to free themselves, but the point is that it is not and never was a valid law in the USA, despite appearances.

On the other hand, a law which is repealed was in fact a valid law from its effective date until the effective date of its repeal. If it was illegal to sell moose meat in Minnesota effective Jan. 1, 1889 until the law was repealed on June 15, 1950 (law, dates, and everything pulled out of thin air as a hypothetical example), Lars Lutefisk, purveyor of contraband moose meat, who was duly tried and convicted of the crime in 1948, was in fact guilty of a crime, and the law’s repeal does not void his sentence – he broke a valid law while that law was in effect.

In the case of Prohibition, the Federal laws which depended on the 18th Amendment for their validity became null and void on the date of ratification of the 21st – but remained valid laws while the 18th was in effect. (State laws were left valid by Section 2 of the 21st.)

So Cletus the Moonshiner and Gino the Speakeasy Guy, convicted during Prohibition under the Volstead Act and related statutes, were guilty of a crime as of their dates of conviction, even though the Constitutional authority for those laws was later repealed.