COSTS (apples) are of course passed on in the form of price markup, by the upstream supplier to the next one downstream. Left to work its magic, free market competition incentivizes innovation and improvement to drive down costs and prices thus gaining more market share. There's always a pressure to push costs and prices down in freely competitive market. So the market itself, free from government interference excepting preventing illegal cartels and monopolies, deals effectively with costs and prices.
PURCHASE PRICES (oranges) are what the tax should be based on. I think this problem you speak of is easily solved by taxing the PURCHASE PRICE, not the costs, which are hard to discern and can be "hidden." Taxing the marked-up SALES price to the next customer down in the supply-chain stream seems pretty straightforward. By subtracting from the tax the PURCHASE price from the supplier upstream, it looks like effectively a single tax for the end item.
I give up.