Say gross profit was $100, IRS-allowed expenses were $10, IRS-not-allowed expenses were $50.
IRS would compute tax based on $100-10 = 90. If tax was 30%, $27 in tax.
Actual net profit was $100-10-50 = $40.
Less $27 in tax gives $13 to take home.
If the IRS had done it right, tax on the $40 * 30% = $12 and the take home would be $40-12 = $28.
So yeah, I agree with the total unfairness of this IRS interpretation.
Regardless of how unfair the tax treatment the marijuana tax laws are, it is still very profitable to sell marijuana legally as the margins are the shops are sky high