The nautical origin of the 'cat out of the bag' definitely refers to taking the cat o'9 tails out of the bag it was kept in. Whether that, in itself, was linked to hiding a cat in a bag to pass off in a market isn't clear. As always, there is dispute about the origins of terms.