Marijuana is legal under Montana law. A Montana man was nevertheless sentenced to a year in prison under federal marijuana laws. He did not grow marijuana. He did not sell marijuana. He was the landlord of a pot business. 
Marijuana is legal under California law. California landlords have been threatened with forfeiture of their property and possible imprisonment under federal law. Landlords have attempted mollify federal authorities being seeking to evict California marijuana business tenants, with mixed results. 
Landlords who knowingly rent to marijuana businesses—even if legal under state law—may face forfeiture actions to seize their property, and criminal penalties including imprisonment and fines under federal law.
Several states in recent years have legalized medical marijuana, and in some states recreational marijuana use as well. This conflicts with federal law and has caused confusion about landlord rights and duties.
Under the Americans with Disabilities Act and similar state laws, landlords must make reasonable accommodations for tenants. This includes allowing disabled tenants to modify their unit at their expense, and allowing support animals in a pet-free building. Questions arise about the landlord’s duties to allow medical marijuana use.
As for purely recreational use, most courts would allow landlords a freer hand under the law. Landlords may impose rules and contract terms to protect their property. A ban on recreational smoking of any substances, or use of substances illegal under any applicable law, would likely be upheld in most jurisdictions. Landlords would likely prevail in court even as to medical marijuana, so long as lease language supports the landlord.
Landlords should have a drug-free policy in the lease, as well as clauses prohibiting any illegal activities. A landlord could argue in court that marijuana use—even if legal under state law—is a nuisance as it subjects the landlord to possible criminal penalty and civil forfeiture of the property under federal law. It is far easier to argue that the tenant simply breached the terms of the lease.
In commercial leases it is common for landlords to demand much higher than market-rate rent for marijuana business tenants, as compensation for the considerable additional risks the landlord is assuming by knowingly renting to a marijuana business. While not having any language about marijuana in the lease is an obvious expediency, the mere fact that the rental rate is off the charts is evidence of foreknowledge, not to mention emails, texts, and simply the testimony of those involved in the negotiations.
Great caution should be exercised by landlords to protect themselves so long as marijuana remains illegal under federal law.
 US Attorney General website, https://www.justice.gov/archive/usao/mt/pressreleases/20120521161556.html .
 See, for example, this news article, http://www.sfgate.com/bayarea/article/Judge-Landlords-can-t-stop-pot-sales-4173547.php .