Echoing what itsjustme said above, the gross brought in by the merchandise is not typically a giant number in and of itself, and the percentage that goes back to the production is really a drop in the bucket for them, certainly not anything that is helping them get over the hump in terms of paying back investors.
I worked for one of the companies for about a year and a half. Granted we didn't have any of the major mega-hits, but even when we had a Best Musical winner that show was still only averaging about $2000 in sales at the height of its popularity, and the best show we had while I was there would max out at $3000 (and that was typically only for the weekend shows). So say a show like Hamilton is pulling in $10,000 in sales per performance. That's only $80,000 a week, which sounds like a lot, but remember that the merchandise companies pre-factor the sales tax into their prices, so even that $80,000 gross is already reduced even before the final weekly reports go to the production. Depending on their agreement, different categories may be commissioned at different rates. So media (CDs, books, scripts, DVDs, etc) may be at a different commission rate than apparel, which is what was common for the company I worked for, but let's say that it all averages out to 25%. So that's about $20,000 a week for the production, which is maybe a handful of actors' complete salary and benefit packages. Obviously not something a smart producer would give up, but not something that's going to be the deciding factor in returning a profit or not.