Then why do many police departments use the 40? Its not cause its cheaper, or easier to shoot.
It's frequently chosen because it has better terminal performance than 9mm after passing through tough barriers, particularly auto glass. Such materials often plug the hollow point cavity and prevent the bullet from expanding, and may also strip away some of bullet material. A .40S&W bullet starts out larger and heavier, so it should punch a bigger hole and retain more weight after going through a hard barrier.
Barrier penetration is less of a factor in civilian shootouts because the usual goal of civilian SD is to stop the attack and/or buy enough time to escape- NOT to dig a determined and potentially suicidal BG out from behind cover.