Cosmoline is a preservative that is primarily for long-term storage. The U.S. military used to dunk their rifles into the stuff then stick them into 55 gal drums until needed (there's a great You Tube video showing the process of preserving M1 Garands this way). Those of us who deal with steam locomotives use it to keep bearing surfaces from rusting up. It is completely removed before the bearing goes into service for the reason mentioned: it attracts and holds dirt and grit (it's also not a very good lubricant).
Brian
'51 Chevy 3604 Project '28 Chevy LO basket case '83 GMC Sierra 4x4