I'm not knowledgeable about these things but I guess you have to add in concessions and parking for a nearly sold out crowd every night. I suppose all the fans need a Soto, Machado, Bogaerts, or Tatis jersey. Not sure how much that brings in though.
I'm not exactly sure about merch sales, but it's a weird structure. The licensing deals pay a percentage to the league that is split between teams equally and players equally. For jerseys sold in the stadium stores, the retail markup goes to the teams. There is money generated in the stadium for sure, but it is probably close to a washout against lease payments, front office salaries, etc.
In mid to low market teams, there is very little incentive to spend to make more money. The expenses are paid directly by the team, and incremental revenue is mostly pooled with the league.