Valeant Pharmaceuticals recently lost its bid to take over the company that makes Botox. But Valeant came out of the process as a winner in a different way.

Valeant had invested $76 million in buying shares of Botox maker Allergan as it attempted the takeover. When another company outbid Valeant for Allergan,  Valeant decided to sell those shares. And it sold those shares at a profit of $397 million.