Manuals are not more expensive to produce, not even close. But they ARE more expensive for manufacturers and dealers to support once they fall below a certain market share when you still have to produce spares and distribute tools and train technicians to service them even though they'll only run into it once in a blue moon.
They also hurt instead of help manufacturer's CAFE ratings at this point. Back when manuals had more gears than automatics they weren't hurting, but now automatics commonly have more ratios and not only that, can be programmed to perform in a VERY specific way during the EPA test loop even if it creates aggravating behaviors in real world driving.
One interesting thing to note is that even though automatic transmissions are now up to 10 speeds, you can look back at the acceleration times of prior generations of the same cars and often times with similar power and weight, cars with 8, 9, 10 gears are not any quicker in timed runs than when they had 6 speeds. They are losing as much time shifting through extra gears as they gain by accelerating slightly harder in each gear. It's actually annoying to drivers to shift more without accomplishing more, so at this point the 'growth' of gear ratios in automatics in road cars serves only to exploitatively 'deceive' the EPA test loop without actually 'cheating'. 6 speeds is essentially the point of diminishing returns for both manuals and autos, but unlike manual drivers who, even having gone out of their way to get a manual, dont WANT to deal with much more than 6 gears, automatic transmissions continue to gain gears that human drivers didn't ask for and can't make much use of, just to optimize for the EPA test loop.