I know you're paying for manufacturing the console as well, but you don't really pay for the marketing or R&D
Yes you do? Why wouldn't you?
Any cost a business incurs developing it's product increases the cost per unit, and has to be paid for by income that company makes selling that product.
just like a Pre-built PC
A prebuilt PC manufacturer just buys existing hardware from Intel, AMD, Nvidia, etc, and slaps it into a case, then install a pre-existing OS on it. There's no R&D there, as another company has already researched and developed everything for them. But it's not that simple for consoles. A lot of console hardware and software is custom.
Marketing is extremely different too. With the nature of PCs being a constant stream of small upgrades, there's no reason to heavily market any one model, just the brand itself.
But with several years between models of a console, tons of money is spent on heavy marketing campaigns. TV, radio, internet, magazine, every form of advertising you could think of. At work, we've considered attending some professional conferences to advertise our product, but didn't want to pay the cost of tens of thousands of dollars. I can't even begin to imagine how much a console manufacture spends to advertise at E3.