The article deals with the problem of cognition in connection with the problem of values. On the one hand, cognition is determined by an object, by the necessary relationship between causes and effects. On the other hand, it presupposes free activity of a subject. Therefore, besides the objective content it contains the moment of assessment. The disregard of the latter aspect of cognition was the main source of contradictions in pre-Marx epistemology. Mechanistic materialism and classical German philosophy are discussed both proceeding from the methodological principles in the solution of the epistemological problem and proceeding from prerequisites for scientific solution of the problem by Marxist philosophy.