Cost of yields: fixed income

why is it better for a firm to redeem bonds when the yields go down? Because, yes, they will be able to reissue bonds at a lower coupon rate but for them to do that they bought the bond at a higher price, so where is it actually the gain? I thought they should buy the bonds when the yields go up, and you can buy the bond at a lower price