Aren't they cheaper than building a computer?
Building yourself an unbranded Xbox or PlayStation (spec-wise that is, good luck getting it to play branded disks or access the stores) out of parts purchased separately is a lot cheaper than paying for the brand-recognition along with the prepackaged build fresh off the "new releases" shelf. The reason PCs are usually more expensive is, anybody who can get into that will want more powerful parts not only so that it'll play high-end games better, it will also last longer before becoming obsolete. Such is the inherent superiority in PC gaming, you get what you pay for.
Not with Nvidia and AMD's modern pricing schemes!
...Well, at least not in the first year of a console's release.
One or two years down the line, you can build a computer that is more powerful than even the newest consoles for the same price or less.
Unless you are the PS4 and Xbox One, of course. Those things were outdated right away and, like you mentioned, just kept their price due to brand recognition.