According to Marx, in capitalism, what role does the state play? Is it independent of the economy? Also, does the exploitation of the proletariat by the bourgeoisie, have anything to do with the state or government?
Marx didn't think that the state should have any role in the economy. The essence of his philosophy is that in the ultimate classless society, the state will have "withered away":
"State interference in social relations becomes, in one domain after another, superfluous, and then dies out of itself; the government of persons is replaced by the administration of things, and by the conduct of processes of production. The State is not "abolished". It dies out...Socialized production upon a predetermined plan becomes henceforth possible. The development of production makes the existence of different classes of society thenceforth an anachronism. In proportion as anarchy in social production vanishes, the political authority of the State dies out. Man, at last the master of his own form of social organization, becomes at the same time the lord over Nature, his own master — free."
– Engels (Socialism: Utopia and Scientific, 1880)
He and Engels both argued that the state was just the executive committee of the upper classes, and that once the evils of capitalism were eliminated, the state would go along with them.
Marx's earlier writings were even more clear in their avowed hatred of the state. For example, in the Communist Manifesto, he argued that the state was a "parasitic" institution that was built upon the superstructure of the economy and that actively worked against the public interest. In particular, the Marxists charge that the state is the primary instrument of repression of the lower classes, serving primarily to prop up the power of the ruling (elite) classes:
Each step in the development of the bourgeoisie was accompanied by a corresponding political advance of that class. An oppressed class under the sway of the feudal nobility, an armed and self-governing association in the medieval commune: here independent urban republic (as in Italy and Germany); there taxable “third estate” of the monarchy (as in France); afterwards, in the period of manufacturing proper, serving either the semi-feudal or the absolute monarchy as a counterpoise against the nobility, and, in fact, cornerstone of the great monarchies in general, the bourgeoisie has at last, since the establishment of Modern Industry and of the world market, conquered for itself, in the modern representative State, exclusive political sway. The executive of the modern state is but a committee for managing the common affairs of the whole bourgeoisie.
– Marx (Communist Manifesto, 1848)