The amount of un-burned powder thrown out of the muzzle can be "moderated" by compression, bullet weight, and increased friction. Over-loads of black powder add to the projectile weight too and result in more powder burned in the barrel. Some un-burned powder can end up compressed behind the projectile creating a "filler-effect" of sorts, reducing or eliminating gas blow-by and improving accuracy. Obviously grain size makes a difference in how much powder is burned in a certain length barrel as well.