gwsmith makes a very good point concerning the number of goats it would take to harvest 4 gallons of bile. In 1805 with no refrigeration, it would quickly putrefy too. And the ledger entry in the OP was a sale rather than a purchase. Why would a gunmaker be selling bile in any quantity? If it was being used for stain, dye, case hardening, or any of the other guesses thus far, I'd think they would be purchasing bile rather than selling it.
Seems more likely to me that the presumably handwritten ledger entry is either faded or somewhat illegible, and actually refers to something other than 4 gallons of goat bile. It might be helpful to see a pic of that entry.