I once heard a Rav say that one way in which he disposes of his stash of Geniza is to bury it with the deceased if the family allows. He claimed that it was a segula (I can’t recall his source). I lately learned that this was prohibited as it pains the soul to see words of Torah (if the geniza contains holy books) while the deceased can no longer fulfill mitzvot. This being similar to why we tuck in our tzitziyot when we enter a cemetery. On the other hand, I also understand that some people get buried wrapped in their Talit. I’m all confused. Can someone please explain the issues at hand and cite specific Halacha.
I haven't checked all the sources listed in the various comments.
I can tell you from personal experience having been to a few more funerals, lately, than I would care for (I know people die. Never makes it easy when it's a relative or close friend :-( ) that I have seen people come with bags of sheimos and bury them with the body. Almost all the burials I have been to have an Orthodox rav who not only doesn't object, but some of the shaimos are his own. So, apparently, there is no prohibition in doing this.
I would hope, though, that someone had asked the closest relative if doing this is fine with them. When we buried my mother in law, someone threw a bag of sheimos in there, and, from viewing my wife and sister-in-law's faces, they didn't seem pleased, as they were not informed beforehand. But, they were also too pre-occupied to object and make a fuss right there.