Given the right circumstances there could be a lucrative market for used underwear. Not mine, but someone’s. Does the same analogy apply to codebases? Probably.
Actually, there is a market for used underwear. Look up the rag trade - industrial rags and the like. They shred old fabric for use in workshop and industrial applications.
Companies are so keen to keep their own code, but most don't realise it would be useless to anyone else.