The biggest clue here is in the very last words of the verse "outside the encampment". Just with a superficial reading you can see that the cultural context between the command being given, and the point in time which the gospel refers to, are completely different.
This in itself isn't enough to answer the question though because you could argue that the city is effectively the new "encampment" and the verse might still apply despite the change in context.
To answer this it's important to understand more of the differences in context, and what exactly the Leviticus verse was originally addressing. When the command was given, the Israelites effectively lived "in the presence of God" (signified by the pillar of fire/smoke). It was a theocracy, with God giving commands to Moses directly. Because of such close communion with God, there was a degree of ceremonial purity that was necessary even to reside in the camp- the idea is that ceremonial impurity can not exist in the presence of God.
After the time in the Wilderness, Israel became a nation, and progressively became more like the other nations around it. The King ruled, and the King didn't necessarily submit to God. There is no one City that can really be described in such a way that would be equivalent to "the encampment" - rather the people are scattered across several settlements and cities, in much the same way as any other nation would be. Instead, most of the ceremonial purity laws now apply more directly to the Temple, as this is now the place that is considered to be where God's presence rests.
By the time we get to the Gospels, the Temple has been destroyed, but also rebuilt, and the nation of Israel doesn't even rule itself (politically), but is under the rule of the Romans. So really, the man with leprosy was in the city because he had every right to be in the city. It might be more of an issue if he was wandering around the Temple.