To support the factual right answers, there is a system proposed in which the residents of an area can get a pass for the coffee shops in that area. As far as I understand only legal residents of the Netherlands can apply for such a pass.
As the system is a proposal only now, not much is made known yet.
And to counter all wrong answers:
Most of the tourists to the Netherlands in general, as well as most of the tourists to Amsterdam in particular do not use marijuana at all. Only one in four visitors visit a coffee shop and most of those do not spend much there.
Those tourists will still be coming to Amsterdam.
The ones that come to be stoned might as well not come to the city as far as their spending is concerned. Most of their money is spend on weed and that money goes into the illegal circuit and is not used for the good of the city and country, while the city and country have to pay for cleaning up after them.
And when they stop coming to Amsterdam, other tourists will come, the ones that are now scared away because of the (false) bad image of the city.
By the way, Marijuana, weed or whatever you want to call it is illegal now, has always been and is likely to stay illegal for years to come.
And there are no 'zilions' or people smoking it here, the percentage of Dutch using weed/mj is smaller than that of countries like the UK and USA where it is illegal. Even all of the tourists do not make that number higher.
One more point that might use clarification, the Netherlands did not 'join' the EU when that was already in existence, the country has been a member of the forerunners of the EU, has always been part of the group of European countries that was/is the core of the EU.
And the Netherlands did not have to change laws at any point, weed/mj has been and still is illegal, only the practical side is different, small amounts of soft drugs and some selling under conditions will not be acted against, which is the same as happens in fact in many other European countries, even when those do not make it as clear.