Oh crap, where does it say... oh,ok. Missed that part. Then it's still simple. It says the farmer can't cut a hole in his sack. Have the merchant cut it.
Cut the sack in the middle, where it's tied, and give the merchant the half with the lentils. It's not cutting a hole in a sack. It could be considered trading, but it is more of buying, because the merchant is paying money for the sack.
wait now i got it, the riddle does.nt specifically say he wanted to keep the lentils so you could hold the middle turn it upside down pour out the lentils and you have only beans.