The government made a nominal profit on the bank bailout.
Early estimates for the bailout's risk cost were as much as $700 billion; however, TARP recovered $441.7 billion from $426.4 billion invested, earning a $15.3 billion profit or an annualized rate of return of 0.6%, and perhaps a loss when adjusted for inflation.
You can call it an inefficient use of money if you want to account for inflation, but all in all, preventing a complete collapse of the banking industry while not directly losing any money isn't the worst deal in the world, and certainly wasn't the runaway heist by the banks.