According to Marxist theory there are two components of capitalist society: base and superstructure. The base compromises the economic forces as well as the relations of production, that is to say those relations between the owners of capital, such as industrialists, and the proletariat, or working classes. The superstructure arises out of the base and is founded on it but is only indirectly related to economic production. It would include, for example, the legal system, philosophical ideas, family, culture, religion, art, and the media. The superstructure constitutes the ideological manifestation of the forces and relations of production. So in a capitalist society, all the various aspects of the superstructure act to legitimate the power of the bourgeoisie formed originally by the relations of production.
Literature, as with all creative activities, would certainly form part of this superstructure, and a very important part at that. Nevertheless, Marx's position is more complex than we might think. He doesn't argue that every single work of literature written in a capitalist society is little more than an ideological expression or justification of capitalism. In capitalist society, a literary text is much more than just a piece of bourgeois propaganda. To insist upon this point would be to advance an interpretation that Marx wholeheartedly rejects. Indeed, Marx explicitly states that the relationship between art and society is unequal; the former isn't a simple, straightforward manifestation of the latter. The superstructure has its own tempo of development, one that isn't simply reducible to a mere expression of the class struggle or the state of the economy.
Marxist criticism, therefore, adopts a nuanced, multilayered approach to the study of literary texts. Although of course it pays close attention to such matters as the author's social class, ideology, and other relevant factors, in doing so it still acknowledges a multilayered critical distance between the individual text and the economic base.