The other answers address the cost of actual research extensively enough, but there are, sadly, other aspects to consider. 

Academic research is, for the majority, funded by the government. That means that, although I have a high opinion of some government funding agencies, **the decisions on how to spend the money is often political**. As any other government organization, members of academia work in a loop to protect their interests and privileges.

As a result, in addition to the natural amount of effort and money spent on endeavors and projects that turn out to be dead ends (these are actually useful to research as they rule out possibilities) there is a tremendous amount of money lost in generating heat.

It's frequent to see faculty being hired because they are the spouse of another faculty, or because they have social traits that contribute to the 'diversity', grants being attributed hoping that the awardee will return the favor, funding being attributed to people on the basis of the number of publications instead of the quality of them (even more so now with the open-access movement and the subsequent logarithmic raise in paper count), etc. Not to mention cases (e.g. in medicine, socio-economics, history) where funding goes to promote the political agenda of the governing majority.

At the end I think at least a good third of academic research is either marginally incremental, frankly redundant or even completely bogus. 

It should be noted that while these sums ('millions!') seem huge to us, the amount of money spent in academic research is typically a fraction of the government's budget.