In a comment baransam1 asks, “Should the government fund primary education, fund higher education, fund research in basic sciences?” The answer is “No, no, and no.” Emphatic no’s.
No for the same reason that the government should not be in the business of income and wealth redistribution. It should not be in the business of charity. It should not be in the business of taking care of the indigent, the sick and the victims of accident and natural disasters. The government should not be in the business of religious indoctrination, or indeed indoctrination of any kind. The government should not engage in commercial activities like transportation and communications. It should not run hospitals and hotels, clubs and cafes, factories and farms. It should not run banks and non-banking financial institutions.
The list of prohibitions — the “blacklist”– is too long. It is best to have a “whitelist” of what the government is allowed and required to do, and nothing beyond that. Why? The answer is one word: violence.
What is it that distinguishes the government (also referred to as “the state”) from all other institutions that a functioning society must have? It’s implicit in Max Weber’s definition of a state as “a human community that (successfully) claims the monopoly of the legitimate use of physical force within a given territory.”
Chief Weapon: Violence
The state here is broadly understood to be the legislature(s), the judiciary and related enforcement organizations. The state can (and does) compel the residents of a territory to obey — at gunpoint, if necessary — its dictates. The content of those dictates don’t matter at this point. It is also not pertinent here to inquire into how the state comes into existence, or how the functionaries of the state are chosen. What matters is the nature of the instrument that it has: violence. Regardless of the form of the state — authoritarian, democratic, aristocratic, technocratic, whatever — it has the legitimate use of force and possesses the means to use it.
“Political power grows out of the barrel of a gun.” —Mao Zedong
Here’s how it works. Let’s take the universally imposed income taxes as an example. The state demands a part of your income. If you don’t pay, the state sends gun-toting law enforcement people to compel you to pay. If you don’t pay, they arrest you and throw you in a cage. If you resist arrest, they shoot you. In the final analysis, you obey because you don’t have the means to defend yourself against the fire-power of the state. The power that the state has grows out of the barrel of a massive gun that the state keeps pointed at you at all times.
Political power is enforced with a gun. The state has the guns. Therefore two implications follow. First, only those activities that necessarily require the use of a gun should be given over as a mandate to the state. And, second, the state must be prohibited from those activities that do not require the use of guns.
To deter crimes, especially violent crimes, and to punish criminals the state has to use violence. The state should have the power to police and prevent people from hurting the persons and properties of other people. That’s the protective function of the state, and for that it does require the use or the threat of the use of force. That is morally justified.
But the state is not justified in using guns in situations that don’t involve violence. Consider charity. If A were to ask B for a donation to help out a needy person, B has the freedom to choose whether and how much to give in charity. But if A compels B at the point of a gun to give him money — even for a praise-worthy cause — that would amount to robbery. B is justified in refusing to contribute. If robbery is immoral for a private person, it is also immoral when done by the state, regardless of how the state is constituted.
The same argument can be made in support of prohibitions against the government’s involvement in all activities that are intrinsically not violent. This is not to say that there are no activities that are inherently “social”, meaning those that require collective action and which cannot be done by individuals. The average individual cannot pay for the neighborhood public library, for instance. Only a collective of individuals can pay for that. But the payment should not be coerced at the point of a gun.
Society and Collective Action
Some things of value to society needs collective action, such as public libraries, helping the needy, caring for the environment, etc. The responsibility resides in the society, not the state. For that, social organizations need to be created by the individuals in society. Since these social organizations do not have guns to enforce their will, they have to rely on non-violent means. They have to persuade people, not compel them., to act voluntarily.
I am willing to give as much as I am capable of giving to support social causes. But if I am threatened by goons with guns to give for a cause however humane, I must as a moral act resist extortion and theft. 
“If taxation without consent is not robbery, then any band of robbers have only to declare themselves a government, and all their robberies are legalized.”
— Lysander Spooner.
Here’s the fundamental principle. Because the state has the monopoly on the use of force, it must not be allowed to engage in any activity that should not require force.
No Business being in Business
The government, for example, must not run railways or telecom or airlines, etc., etc. (as it does in India.) Basically, the government must not engage in business because it’s the government’s job to ensure a level playing field for businesses, to be a sort of a referee. By doing business, the government enters the playing field, and thus handicaps the other players. Most certainly, the government must not be allowed to be the monopoly provider in any industry. That way it becomes the sole player in the game, and as the referee declares itself the winner. Everyone loses and the functionaries of the state win. That is the road to poverty.
What about education? It is the job of the society to educate its young, and the primary responsibility lies with the parents of the children. Granted that the really poor do not have the resources to educate their children. That’s when the society has to step in, and collectively help those who need it.
What about higher education? The benefits of higher education are primarily private, and therefore the costs must be paid privately. In those cases where a person faces a credit-constraint, mechanisms such as loans and grants are appropriate.
What about the funding of basic scientific research? Once again, it’s not the government’s job. Private foundations are the institutional mechanism for that. Beside that, you have for-profit corporations to fund basic research.
What Should the Government Do
The state has to ensure domestic tranquility, i.e., prevent force, fraud, theft and protect citizens from other citizens; and provide a credible defense against foreign threats. Both these functions require that that the state have guns and use them when necessary. Nozick called that the “nigh-watchman” or minimal state; it is justified on moral and ethical grounds. It only protects individuals from domestic and foreign violence.
However there’s a problem. How do you prevent the state which has guns to protect the citizens from turning those guns against the citizens? That’s why we have another institution called “the constitution” — it is meant to limit the power of the state. (There’s one little difficulty about that but for now we can move on without reference to what that is.)
In the Federalist Papers No. 51 (published 1788), James Madison (and perhaps Alexander Hamilton) explored the nature of government and inquired into the matter of why constitutional checks are important:
“It may be a reflection on human nature, that such devices [checks and balances] should be necessary to control the abuses of government. But what is government itself, but the greatest of all reflections on human nature? If men were angels, no government would be necessary. If angels were to govern men, neither external nor internal controls on government would be necessary. In framing a government which is to be administered by men over men, the great difficulty lies in this: you must first enable the government to control the governed; and in the next place oblige it to control itself. A dependence on the people is, no doubt, the primary control on the government; but experience has taught mankind the necessity of auxiliary precautions.” [Emphasis added.]
The conclusion is that the best we can do is to limit the government so as to avoid the excesses that arise from the destructive power that governments have. The state should not be a productive state, only a protective state.
 Weber, Max (1946). “Politics as a Vocation.”
 See “Lysander Spooner” (2018) on this blog. Spooner (1808 -1887) was an American political philosopher and abolitionist. Here’s a quote:
“A man is no less a slave because he is allowed to choose a new master once in a term of years. Neither are a people any the less slaves because permitted periodically to choose new masters. What makes them slaves is the fact that they now are, and are always hereafter to be, in the hands of men whose power over them is, and always is to be, absolute and irresponsible.”
 See “Who Actually Paid for my Education” (2000) on this blog. Part of it was paid for through a government scheme of robbing the poor.