The U.S. Congress passed the Protecting Americans from Foreign Adversary Controlled Applications Act (division H of Public Law 118–50), which targets TikTok. The law prohibits U.S. companies and app stores (mainly Google's Play Store and Apple's App Store) from hosting TikTok unless Chinese parent company ByteDance divests from it.
However, president-elect Trump seems to be opposed to this TikTok ban. According to this article:
Another move Trump could technically make if the TikTok ban takes effect is to say his Justice Department just won’t enforce the ban, inviting companies like Apple and Google to leave the app up on its app stores without facing the harsh financial penalties that the law imposes. But that’s unlikely to work, as legal experts have noted companies would likely comply with the ban anyway, rather than risk facing penalties if Trump ever changed his mind.
(also this and this article mentions this)
If Trump and U.S. Department of Justice publicly announced that they would not enforce the law, and companies like Google and Apple (relying on that announcement) kept TikTok in their app stores, could Trump (or a future president or the Department of Justice) later change his mind and fine the companies for not complying with the law even "retroactively"?
Could the companies use such a public statement as a defense against the fines?
The law is currently being challenged as unconstitutional before the U.S. Supreme Court in TikTok v. Garland, but for the purposes of this question, assume that the law was upheld.