I provided sources to the costs, they are also easily obtained by Googling -
1) tsmc n7 wafer cost
2) tsmc n4 wafer price
Your source said 18k for n4, battlemage uses N5 which is quoted as 15-16k. If n4 is more expensive than N5, N6 is also likely more expensive than N7. Guess what uses N6 not N7... the rx 7600. N7 is listed at 10k, even being genererous N6 is probably around 11k at least.
So instead of 20k vs 9.5k like you said, it's 15-16k vs 11k. Regardless of your grossly misquoted prices, how many times do I gotta tell you that battlemage is n5 not n4, and rx 7600 is n6 not n7. N5 =/= N4 and N7 =/= N6.
In order for this to be true a 300 sq mm chip with perfect yield giving 200 per wafer would need to have wafer cost of $8000.
I said +40 dollars meaning +40 dollars from AMD rx 7600 die(twice as expensive). and +10 for 4gb memory. All other costs being similar that means that the b580 only costs around 50 dollars more to produce than the rx 7600, well within margin to break even. AMD prices their cards to have a margin so they can pay for R&D and other costs. Intel pricing their cards low to gain mindshare and cuz even pricing their cards higher likely not enough to pay for R&D anyways, they are invested long term.
AMD has got revenues from consoles that sell better than their cards, well, until Xbox sales tanked, now that's a problem.
Their consoles sell better than their cards but at the same time have lower margin, which is the entire point of a console, low margin but high volume of the same one product. AMD makes a healthy margin off their cards, it is not crazy to think that battlemage is not losing intel money for each card they sell.