If science is free by default, what will be the motivation for scientists to produce more of it?

Correct me if I am wrong and the money, in **fact**, goes to some undeserving third-party. But who will choose to write a book or conduct a study without monetary gain? Few.

Edit: I see. So who pays scientists and what are the consequences of all science being free – for science? Also by monetary gain I meant not only huge profit but first of all food and shelter etc… Which are not dependent on how greedy or passionate about science you are.

So am I to leave this thread with the conclusion that if science was free, its authors would be no less wealthy?