The fact that some states like Colorado and Washington allow anyone who can prove that they are over 21 to consume marijuana has created a very complicated legal situation. Indeed, it is legal to do so, but everyone (including citizens and permanent residents) is breaking Federal laws (under which it is illegal to buy, sell, or possess controlled substances). While the Obama Administration is looking the other way while this is happening, it does not mean that these individuals are immune from prosecution. In fact, citizens who consume these drugs legally in these states maybe jeopardizing their chances when it comes to working for the Federal Government.
So what are the implications for legal and illegal immigrants? The simplest advice is unless you take the oath as a US citizen, don't even go anywhere close to illegal drugs (this applies even to medical marijuana in states like Massachusetts where it is legally sold to anyone with a prescription). All immigrants are covered by Federal laws because it is the Feds who enforce immigration laws. The last thing you want is your name popping up in a database search as someone who enjoys smoking joints in Colorado or Washington. The Feds will be within their rights not only to deny you an immigration benefit (e.g. naturalization to a permanent resident, or green card to anyone legally present, etc.) but to even invalidate your current legal status and deport you for breaking United States Controlled Substances Act of 1970. In case you didn't know, CBP agents routinely deny tourist visas and entry at the border to anyone suspected of using drugs even in their native countries.