Howdy
When I am done cleaning a revolver,rifle, or shotgun that has been fired with cartridges loaded with Black Powder I soak a patch in Ballistol, then run it through the chambers and bore of a revolver, or down the bore or bores of a rifle or shotgun. I follow up with a clean dry patch to soak up the excess. This leaves a fine coating of Ballistol in the chambers and/or bore.
As has been mentioned, Black Powder fouling is hygroscopic and will absorb moisture from the air. But if the fouling is soaked with oil, it cannot absorb any moisture out of the air, just like a sponge soaked with water cannot absorb any more water.
In antique rifles and revolver, which have pitted bores I do not try to remove every last molecule of fouling. Some will always remain in the bottom of the pits. Soaking the bore in Ballistol this way prevents the remaining fouling from absorbing moisture and causing any corrosion. I have been doing it this way for close to 20 years, it really works.
By the way, I find the odor of Ballistol to be pungent, and it causes me to sneeze, but it is such a good product I put up with the sneezing.
Any oil will work, I just like Ballistol.
WD-40 is a Water Displacement formula, it was never intended to be a lubricant. It probably works fine for this, but I prefer Ballistol.