+1 to you for offering to pay, several times. +1 to him for letting a customer have a part he needed and not expecting payment or for even bringing it up to you. I've had to insist that Tom at my LBS accept payment for parts I get and he wants to either discount them of give them to me. I simply pay and move on. If he insists and discounts or says just take it, I don't argue or keep coming back about the money.
If the shop owner really needed to be payed for the stem he would have taken the money when he had quoted a price. He probably feels like this is a small price to pay for building customer loyalty, I know it would stick with me. Don't sweat always having the money every time you go into the shop, your repeat business is most likely the payment he wants the most. Recommend the shop to your friends and other riders, this is your repayment for his courtesy. Ride Safe and Ride Lots.
Bill