In Stone v. Graham, 449 U.S. 39 (1980), the Supreme Court of the United States ruled that a Kentucky statute was unconstitutional and in violation of the Establishment Clause of the First Amendment, because it lacked a nonreligious, legislative purpose. The statute required the posting of a copy of the Ten Commandments on the wall of each public classroom in the state. The copies of the Ten Commandments were purchased with private funding, but the Court ruled that because they were being placed in public classrooms they were in violation of the First Amendment.
Probably virtue signaling more than anything, they dont really care if it stands the courts or not. They just need to make the base happy for a moment.