It's not nationally illegal, and yes I would I agree that this seems in clear violation of freedom of speech. There have been some similar laws passed at the state level like this one in Texas https://gov.texas.gov/news/post/anti-israel-policies-are-ant... that have somehow held up in the courts