That is why you use hard cast bullets. You can also use gas checks. I don't know if you can get them, but Hornady makes a .35 caliber gas check that seems to work fine in 9mm.
For those who are not familiar with gas checks, the main cause of lead fouling in barrels is not the friction of the bullet against the barrel but the hot propellant gas melting the base of the bullet.
and Okie's comment about sizing also supports the blowby idea.
One of the problems though w/the 9mm Luger and other high pressure rounds in a semi auto is that they require a pretty specific operating pressure.
That limits the coices of powder.
I can drive a soft swaged lead bullet in a .44mag pretty fast (1600-ish) fps. w/out any leading at all in my Winchester Trapper.
I have to use a slow powder like Alliant 2400 to do it though.
If I try to use a faster powder, like Unique or 231, they burn too hot and blow past the base and cause leading.
I'd expand on this more,,,,but,,, I just had a glass of Vegtable juice w/a quarter spoon of Ghost Chili pepper sauce mixed in. It appears I didn't wash m hands well enough before I hit the bathroom to get rid of the two cups of coffee.
I need to get to in the shower a bit faster than that .44mag tossses lead.....