A foreclosure sale is basically a short-sale. In a foreclosure sale, the bank may or may not have obtained summary judgment. Typically, a foreclosure sale is one where the bank is responsible for mitigating the investor's loss (ie...FHLMC, FNMA, or GNMA) as the servicer of that loan.
A court-ordered sale is a sheriff sale. This can be done for many reasons (ie divorces, bankruptsy or post foreclosure). Most of the time this is done so that the bank can obtain funds from the sale of the property to recoop any losses the bank may have sustained from that loan or to be able to buy back the property to be able to sell it outright and recoop any of its losses. In the case where the bank buys the property at sale...it then becomes what most people know as an REO (real estate owned).
Most sheriff sales have a starting bid amount of 2/3rds of the BPO (for conventional) and around 82% of FHA/VA. What you find at the sale is that the bank will be there to drive up the price if possible. In the end, they will likely buy it back regardless...DO NOT get into a bidding war with the bank. You can get the property cheapier through REO than what the bank pays at the sale.