We saw elsewhere how “to let the cat out of the bag” was connected with the other familiar saying, “to buy a pig in a poke.”
Proof is lacking, but it seems to me that the unfortunate wight who bought a pig in a poke and soon after let a cat out of the bag, could very well have served as the prototype of the person who was holding the bag.
The saying “holding the bag” is also old, and from its first appearance in literature has meant “left in the lurch,” holding responsibilities that one has not contracted which have been evaded by the one who should bear them.