In my sefer, Nasiach B'chukecha (pg. 61) I quoted the Mishna Berura (38:24) who quotes the magen avraham that when one is doing a mitzvah and also profiting such as tefillin merchants, they are only considered osek b'mitzvah to be exempt from another mitzvah when their primary intent is the mitzvah. The Magen Avraham is medayek from rashi in succah 26a that if their primary intent is for profit, they don't have the status of osek b'mitzvah to exempt them from another mitzvah. The Biur Halacha asks on this from our sugya. The gemara concludes that although a lender who takes a mashkon is technically a shomer sachar on the mashkon based on the same din of shomer aveida - namely, he is involved in a mitzvah and therefore exempt from giving tzedaka. But, when he takes the mashkon for his personal use (and will deduct some amount from the loan to avoid the ribbis problem, as rashi writes), we have a machlokes r' eliezer and r' akiva. R' Eliezer holds that since his intent is really for personal benefit, he is not considered to be doing a mitzvah and therefore doesn't become a shomer sachar on the mashkon. We pasken like R' Akiva that he is considered to be doing a mitzvah and therefore does become a shomer sachar on the mashkon. The biur halacha points out that this seems to imply that even if one's primary intent is for profit, he is considered to be doing a mitzvah and therefore becomes a shomer sachar, which is against the magen avraham? The Biur Halacha pushes off the question by saying that the case must be where his primary intent is not for personal benefit, rather to do a mitzvah of lending and that is why r' akiva still considers him to be osek b'mitzvah.
The approach of the biur halacha doesn't fit well with rashi. Rashi explains that when the lender takes a mashkon to use for personal benefit, R' akiva holds that he is doing a mitzvah and therefore a shomer sachar - ור"ע סבר אפילו הכי איכא מצוה. Rashi doesn't say that his primary intent is to do a mitzvah, rather rashi says that even though להנאתו מתכוין as the gemara says, nonetheless it is an act of a mitzvah to consider him osek b'mitzvah. Rashi implies that R' akiva doesn't disagree with r' eliezer about the premise of his primary intent being for personal benefit, just that he holds that even so since he is doing a mitzvah he is considered osek b'mitzvah to be exempt from tzedaka and turn into a shomer sachar. This seems pretty clearly against the approach of the biur halacha.
In the hosafos to my sefer I attempted to answer this question.
Click here - page 5-6 and the end of #13.