It hasn’t reached the Supreme Court for a decision, but lower courts have basically said that it’s not establing a religion because it’s used in a secular and patriotic fashion. (My interpretation of my understanding of the ruling).
https://en.m.wikipedia.org/wiki/Aronow_v._United_States
You can blame 1956 Cold War era Congress (red scare) and Eisenhower.
WORK WORK