I don't know if I would describe a film like Prometheus with a budget of 130 million, grossing 400 million at the box office as "did badly at the box office."
You have to include marketing costs, the distributor's cut, residuals, taxes, etc.https://stephenfollows.com/how-movies-make-money-hollywood-blockbusters/
That is, marketing costs might be around 80 percent of the budget, but it might be similar to the budget if we add residuals, etc. That means the total studio cost might be up to $260 million.
For the box office, there's a 30-to-50 percent cut for the distributor and sales tax. I always calculated it at 30 percent but I never thought of the sales tax, which means the studio's cut might be somewhere in between. The source above states that the ave. return for the studio has been 41 to 50 percent of box office receipts. If we use the lower end, then the studio's cut was around $236 million. If so, then one can argue that the movie was not profitable.
However, if marketing costs were not that high, then maybe the movie made a slight profit, even after paying corporate tax. Of course, there are other revenue streams, like merchandising, but those arrive later, so I usually stick to box office receipts.