Because the per capita murder rates are lower than in southern cities without much gun regulation. In truth, though, I think all cities could have NYC murder rates if we had NYC's population density (27.5K per sq mile). Of course, most southern cities have fewer cops per capita and per square mile, because they don't have the tax revenues that come from being the nation's historic capital of finance, fashion, journalism and all that jazz. If implemented in southern cities, NYC's gun laws would lead to a massive crime wave.
Why do you attribute it to NYC’s population density? In general, cities have more crime on average than less densely populated areas of the country.