Would borrowing a torah book (without permission) from a shul be considered mitzvah haba b'averah if you use it to learn from ?
2 Answers
There are a number of different circumstances that would occur that would allow someone to use a sefer in shul without explicitly asking permission. The question however, seems to imply that someone has taken the sefer from the shul without first asking permission. Thus, using a sefer (that belongs to someone) in the shul is different than taking a sefer home from the shul without asking permission or notifying someone (such as the rav or the gabbai) who has the authority to allow it.
If this is done, you have prevented someone else from being able to use it. That is why someone who uses a sefer in shul should return it to the shelf where it belongs.
The Mishna Berura in siman 14 sif 4 talks about borrowing a talis in a shul without permission. He brings down a number of reasons to limit the heter to do so (the Pri Megadim says that we don't rely on the chazaka of "nicha lei" when the owner is around and you could ask him; you can't take it out of the shul; there is a tumult in the poskim about how you must put it back). In the last sif katan in this sif he talks about borrowing seforim but does not talk about any of these reasons because the Rama himself asurs it based on the fact that seforim in those days were more fragile.
The Piskei Teshuvos (great sefer, highly recommended) brings down a list of four other reasons not to rely on the heter (by a talis):
A) The Mishna Berura says it's only mutar to rely on this heter "b'akrai (happenstancially)", but the geder of this is unclear.
B) Some poskim say that this heter of nicha lei only applies by a mitzvah chiyuvis (unconditionally obligatory, think of tefillin), but not by a mitzvah kiyumis (is a mitzvah only under certain conditions, think of tzitzis). And in all likelihood, it's possible to accomplish talmud Torah (assuming it's a mitzvah chiyuvis, which is not pashut) in some other way than taking your friends sefer.
C) Lots of people are makpid today on their property not to be borrowed. (See the reason he gives, lechorah it doesn't apply to seforim.)
D) The risk is high, if you don't return it properly, or if you take it out of the building, it's gzeila.
The Magen Avraham is metzayen a Rama in C"M siman 163 sif 6, at the very end of this very long Rama he brings down that he found in old takanos that it was made asur to remove seforim from the beis medresh without the permission of the owner. Also, the Shulchan Aruch Harav says outright that this heter of nicha lei doesn't apply to situations of taking the item from one house to another, as there is no chazaka that a person is okay with this.
I try to be extremely cautious about this because the isur is one of gzeila (shoel she'lo mida'as gazlan, see Bava Metzia 41a). If you don't know with certainty that the person would be okay with you borrowing their sefer, you probably shouldn't. But, (to address your question directly) it should be noted that if the sefer is in a shul it would be mutar to learn from it there (like the Rama in C"M says outright).