This is Big Joe and the Nth Generation (The story starts on page 90 of the pdf linked), aka It Takes A Thief, from Walter M. Miller.
Summary translated from the wikipedia page of the French anthology where I read it (I couldn't find a summary in English):
On the colonized Mars planet, in the distant future, technological knowledge has fragmented and dissolved to the point of becoming the privilege of the nobles and the rich. The novel begins with the punishment inflicted on Asir, a "thief of knowledge" who doesn't know what his sentence is. As long as he does not ask for the execution of the sentence, he will remain chained to his post. Tired of waiting, he forces himself to ask the executioner to carry on the sentence: he learns that he is condemned to banishment for life. Aided by Mara, who loves him and whom he loves, he does not flee the country but instead joins the forbidden crypt on which Big Joe watches - a monstrous robot, intractable guardian of unknown knowledge. Asir manages to thwart the mistrust of the robot and behaves like one of the "technologists" of the old days. Having understood that the robot was only a mechanical being and not a jealous god, having tamed and discovered that the guarded room was only a "room of knowledge" among many others, and that it will be necessary to assimilate piece after piece the knowledge accumulated in these places, he returns with Mara to the city to offer his community the secret he has just discovered. And the most fun thing about it is that the village leaders will become, in turn, "thieves of knowledge"!