"Democracy is based on the assumption that a million men are wiser than one man.
Except that simply not true. Democracy is is not about reaching some imaginary "best" decision (WTF is "best" anyways? By what metric?). Instead, democracy is based on the assumption that, if everybody can vote for their own interests, then a balance will be reached between the different personal interests present in a society.
That is why it is important to separate political decisions (decisions about preferences and tradeoffs between preferences) from decisions that are technical. The technical decisions should be made by domain experts. The political decisions should be made by democratically elected representatives, who are accountable to the public.
In the example of the NSF, the political decision is how much public funding should be made available to research. That decision is the one that should be under public scrutiny, and politicians should be accountable to the public for their stance on that issue. The technical decision is what research projects have enough merit to be funded. That decision is currently made by domain experts (the evaluation boards), which is as it should be.
Now compare this to the intelligence services. Politicians make decisions about funding as well as general directions of the agencies. Day to day operational details are handled by the domain experts. So far so good. The trouble is, that due to secrecy, the political decisions are in fact NOT under public scrutiny; there is no accountability, and that is what makes the process undemocratic.