The holiness commandments for Israelites, especially found in Leviticus 17-27 and with the apex being in Leviticus 19, are about going above and beyond mere legal requirements. God is holy and so his people are to be holy (19:2). And imitating God means care for the imperiled and needy: “He executes justice for the fatherless and the widow, and loves the sojourner, giving him food and clothing” (Deut 10:18, ESV). Leviticus 19 contains the most potent ethical holiness laws, such as imitating God (vs. 2), loving neighbor (vs. 18), and even loving the sojourner (vs. 34, like Ruth).
Gleaning is a holiness commandment, a prescription to Israel to go above any sort of normal human obligation to care for those in need and, sure enough, it is found in Leviticus 19. The corners (pay-oat, usually transliterated pe’ot and singular pe’ah) of the field should not be reaped. Standing grain is to be left in the corners so people in need may glean (lakat) the remnants. A tractate of the Mishnah (Pe’ah) is dedicated to the full meaning of this law, expanding it into various areas of life in which those who have preserve remnants of their abundance for those in need. Being generous in the size of the corners of your field is a mitzvah (good deed).
In the JPS Commentary, Eskanazi considers why Ruth says in 2:2 that she will glean behind the person who shows her favor. One possibility is that the laws of gleaning were commonly neglected in the days of the Judges. Perhaps resident aliens (sojourners) and other needy people took a risk in attempting gleaning (an act that may have been regarded like panhandling). In vs. 7, we find out that when Ruth came to glean, she did not take this as a right, but asked permission. In vs. 8, Boaz warns her to glean only behind his women. In vs. 9, Boaz implies that gleaners might be molested by field workers and guarantees Ruth’s safety in his fields. That Ruth came to Boaz in a dark time, that he was generous in his performance of the laws of gleaning, is a picture of the way hesed (lovingkindness) improves the world.