As far as i know, drugs are not legal in the netherlands, nor in amsterdam.
Weed is "tolerated" and so are the coffee shops. There's no difference between people living there and foreigners/tourists.
There's tons of coffee shops in amsterdam. In all of them you are allowed to buy and smoke weed (if you're 18 years old at least). As far as i know, you could get in trouble for smoking weed outside on the street (but even then, it would probably not be a big deal).
Ohh and... if you want the good stuff, and not too expensive... it will most likely help if you go to a coffeeshop which is not near to the center of amsterdam... those are only there to rip off tourists.