It all depends, jimmycurry. Sometimes it is a planned co-production with companies sharing the cost, such as Show Boat (which was conceived as a co-production between the Lyric, Houston Grand, Washington National, and San Francisco).
Other times a company will keep a production in storage and rent it to other companies. Depending on the production it may come with stipulations that the original director has to be hired to re-stage it, or at least offered right of first refusal, along with various other members of the design team.
And sometimes a company may no longer have the space to store a production so they may indeed try to sell it outright to another company instead of trashing it. That company may then decide to use it once or add it to their own rental stock. I worked for one company that bought several productions from other companies while I was there and subsequently made some money back renting them out.
Set rentals can provide a nice flow of extra cash for a company if they happen to own a well-designed production of a popular piece (such as Carmen, La Boheme, or Madame Butterfly, for instance).