Finasteride goes by the brand name Propecia (for MPB) and Proscar (for BPH) and is a 5-alpha reductase inhibitor used to treat male pattern baldness (MPB) and benign prostatic hyperplasia (BPH) [enlargement of the prostate]. The medication works by inhibiting the enzyme that converts testosterone to its bioactive metabolite dihydrotestosterone thus decreasing its levels in the body. Dihydrotestosterone is implicated in causing direct damage to the hair follicles that can lead to MPB and damage to the prostate causing BPH. The role of testosterone and dihydrotestosterone in muscle growth is not completely understood, however, it is known that low levels of both of these hormones in an elderly male can lead to muscle weakness and loss of muscle mass and conversely that increasing these levels cause an increase in muscle mass and strength. This medication could be contributing to your inability to gain muscle, however, there is no way to tell if it is the exact cause. There are many other reasons that could explain your inability to gain muscle despite exercise and diet; the type of exercise you are doing, the type of diet you eat, and your body may not be responding if you continue the same diet and exercise plan for an extended period. Consult a nutritionist or personal trainer at your gym for specific recommendations on how you could change your routine and see if that may help. As for the medication causing these effects, the only way to really tell is if you discontinue the medication and see if you notice a difference. The only other available treatment for MPB is Rogaine (Minoxidil) which is in a different drug class and would not have the same effects on the levels of dihydrotestosterone in the body.
I should include that I am aware that the drug maker does not list inhibition of muscle growth as a possible side effect.