I think that it-ogo’s post sorted things out fairly well. It’s just that it was a bit confusing because he used the phrase to give away, which means to reveal or betray, to mean to give something to somebody, to lend. So, if I feel sorry for the book, for it was a great book but it burned down in a fire and I don’t have it anymore, then:
Мне жаль книгу.
If I grudge giving the book to you, I don’t want to part with it, then:
Мне жаль книги. Although it wouldn’t be much of a mistake or any mistake at all to say in this case Мне жаль книгу too.