This website contains age-restricted materials including nudity and explicit depictions of sexual activity.
By entering, you affirm that you are at least 18 years of age or the age of majority in the jurisdiction you are accessing the website from and you consent to viewing sexually explicit content.
How is it illegal? If the terms are on the lease, and you agreed to them, then it’s no different than any other business contract. What law prevents a landlord from making that one of the terms?
Unless it is a shared dwelling where you sign the agreement in statement that you cannot drink alcohol due to some underlying mutually agreed reason, no tenant can be prohibited from consuming alcohol in their OWN dwelling space. What you do in your home is your business and no landlord can prohibit anyone from drinking alcohol, period.
Even if you sign the agreement on a lease or rental saying you will not, it would not be enforceable in a court of law and the landlord can be sued for cancellation of the contract for attempting to infringe on your personal rights (religious or otherwise).
Edit: All this assumes all parties are in the USA, are of drinking age and there are no dry-county statutes in the area. Consumption of alcohol is protected by the 21st Amendment of the Constitution https://en.m.wikipedia.org/wiki/Twenty-first_Amendment_to_the_United_States_Constitution