As Boaz promised in the last chapter, he goes to meet with this "close relative" who has priority over his claim to Elimelech's inheritance. From this encounter, we see many details of how Israelite society functioned.
In particular, what we see here is more or less a legal proceeding. Everything takes place at the city gate, which is where such things happened. "Those who sit at the gates" is an expression that refers to the elders of a city, those who are honored in the city. They are like the ten elders who Boaz gathers to witness his dealing with the "close relative". Their testimony is what Boaz would rely on if there was any future dispute, so witnessing a legal transaction implies a level of reliability.
Some examples of this: Gen 19:1, Lot was sitting in the city gate of Sodom when the two angels arrived. Even though Lot was a foreigner, he was also wealthy and apparently honored in the city. Gen 23, when Abraham buys the field from Ephron the Hittite, he does so at the gathering of people near the city gate, amongst many witnesses. There are also various future references (2 Samuel 19:8, Esther 2:19-21) that imply this legal tradition continued long into Israel's future. We can also see in Gen 23 that the Hittites had the same custom, and in Esther 2 we can see that the Persians also had this custom. So it appears to be a cultural tradition that spanned many centuries and nations.
So that's what's going on when Boaz gathers the "close relative" and the ten elders at the city gate. The transaction itself is another cultural tradition, which is closely related to levirate marriage. It appears that this close relative is expected to "buy" Elimelech's property from Naomi, but also acquires Ruth as a wife. The expectation is that, like in a levirate marriage, the close relative would raise up sons for Naomi that would legally be counted as children of Elimelech. Or perhaps more properly, they would be counted sons of Mahlon, because that was Ruth's husband. It's not clear why he wouldn't marry Naomi; perhaps she was past the age of child-bearing and therefore ineligible for such a marriage.
Either way, we discover that the close relative is eager to acquire property, but much less eager to acquire a levirate wife, maybe for the same reason that Onan did not want to raise up sons through Tamar in Gen 38. It's not exactly clear why there is a risk, but probably what the "close relative" is concerned about is that he would have children through Ruth, and if his sons through his own wife die then his inheritance would go to the sons of Ruth. They would carry on Elimelech's name, so the "close relative" would not have an inheritance in his own name. It seems that this is one of the legal complications of having biological children who are "regarded" as being the children of another man. Perhaps it created some sort of ambiguity, where (as biological children) they are permitted to have their father's inheritance, but in the name of the other man.
Either way, the "close relative" relinquishes his claim to the property and Ruth, and Boaz takes it instead. Although it would be surprising for a man of his wealth and stature, perhaps Boaz was still single at this time and that's why he didn't have any reluctance about marrying Ruth.
Verse 7 tells us another one of their customs, about a man taking off his sandal "to confirm any matter". I can't imagine any possible etiology for this custom. Apparently it's just what they do. However, I can't help but think that this is meant to reference Deut 25:9, because it's also part of the Law that any man who refuses to perform a levirate marriage for his brother is to have his sandal removed by his brother's wife. In this chapter, it says that the man himself is to remove his sandal as a sign of finality. So the two customs are not identical, but they are so similar I think they must be related. This is probably because of some sort of implied significance to wearing sandals.
We also know that in many places men are instructed to remove their sandals as a sign of reverence. Moses was commanded to remove his sandals in Ex 3, and Joshua was similarly commanded in Joshua 5. If I had to guess, I'd say that sandals are a sign of authority. So a man removes them voluntarily to confirm an agreement, but if a sandal is taken from him that is a mark of disgrace.
So that's the first irony in this story, that the "close relative" removes his sandal. The second irony is that the blessing given to Boaz references "Perez whom Tamar bore to Judah" (v. 12), because that story (which occurs in Gen 38) only happened because Onan sinned regarding his brother's wife, and then Judah sinned by refusing to give Shelah to Tamar as another husband. This book is about levirate marriage done right, and the very benediction for Boaz refers to his ancestor who had gotten it wrong. So that's ironic. Even within this chapter, we have one man refusing his duty to his brother, and another man accepting it.
In the end they get married, and Ruth gives birth to a son. The son is placed on Naomi's lap as a sign that the son is "accounted" to Naomi and her former husband Elimelech. This is the same thing that Rachel refers to in Gen 30:3, when she says of her maidservant, "go in to her [i.e. have sex] that she may bear [children] on my knees". Rachel is referring to Jacob having sex with her servant, but having the children counted as Rachel's. This completes the story arc for Naomi, who lost everything in Moab and called herself Mara, but now has a son to her name and has Ruth, who is "better to you than seven sons". Both Ruth and Naomi, we can figure, lived happily ever after, as Ruth gains a new husband and Naomi has her hope and future re-ignited by her son, Obed.
This story would have been part of the book of Judges if it weren't for the genealogy at the very end. Obed, as we can see, is the grandfather of the future king David. In fact, this is the first reference in the OT to David, so that's why I haven't talked about him much before, but king David is a pivotal figure in Israel's history, and also in the theology of the OT. I'll say more about him later. For now, I will just say that this genealogy is what completes the bridge between the "judges period" and the "kingdom period" in OT history. What's great about this genealogy is that it ties together figures from three historical periods in Israel who are all directly related to each other. In this way, it shows us both literally and metaphorically how Israel passed from the time of Judah and Perez (the patriarchs), to the time of Boaz and Obed (the judges), and from there to the time of David (the kingdom). Nahshon was the leader of Israel during the exodus, so I can probably include that as a fourth period, between the patriarchs and the judges.
Some commentators claim that the genealogy is a late addition and not part of what was originally Ruth's story. I can see why they would think that, but at the same time I think the entire book of Ruth is serving as a bridge between the judges and the kingdom, and the genealogy summarizes and reinforces that purpose. So I don't think the genealogy distracts from the message of Ruth, and indeed it would be hard to understand the story of Ruth without looking towards the future, what resulted from Ruth's marriage to Boaz.
It's amazing to think that a Moabite would be an ancestor of king David. It's even more amazing to me that this would be the subject of a book in the OT, when so much of the bible describes the open hostility between Moab and Israel. Some commentators suggest that is the entire purpose of Ruth, to show that inter-racial marriages with Moabites were not always a bad thing, and that Ruth must therefore be dated to a time period when that was known to be a controversial issue.
I'm not sure if I believe we can date Ruth's authorship based on this one issue, but I agree that it is central to the narrative in this book. Israelite men were strongly discouraged from intermarrying with other nations, and yet both Boaz and Ruth are portrayed as righteous in this book, and their marriage results in the later birth of king David. I think this book was meant to be challenging to its ancient Hebrew readers. Even to me I feel like it challenges my understanding of the OT and the Mosaic Law. It's as if God were throwing in a contradiction just to keep us from getting too comfortable with ourselves and our understanding. It's like God is saying, "you always thought things were supposed to be this way, but now I will do things that way and it will be even better."
I also think God is doing this to show us that there is a higher truth. The Law is true and is a truth, but there is a higher truth that supercedes it, and possibly also a higher law. I think we are meant to be unsettled by this book, and that it gives us a glimpse into a different reality that we may not have foreseen. The Israelites must have known that the Law of Moses forbade intermarriage with other nations, but it seems there is some other law where the LORD approved of it, a law governed not by Ruth or Boaz's ethnicity, but by their righteousness before the LORD.
But just as the window opened, now it closes as we move on to the book of 1 Samuel. But I want this story to be on people's minds as they read through Samuel, because we should always remember that God does not operate with human prejudices, and that the righteousness of any man or woman is more powerful in God's sight than their ancestors or "being born in the wrong family". Ruth was born into the "wrong family" but was righteous in God's sight because her heart was pure. Indeed, God looks at the heart, while mankind only looks at the skin, and as a result mankind misjudges the issues of good and evil.