If you follow the link which @def posted in his message (https://ibkr.info/node/1839) you will see that you have a free choice whether you join the so-called Stock Yield Enhancement Program or not. If you don't want your shares to be loaned out you simply don't enroll to this program.The situation you describe sounds doubtful.
Margin agreements usually have clauses that inform you shares can be loaned out. It is not up the customer. At some firms which offer cash accounts with fully paid for stock the broker has to have a specific agreement to loan out shares. You might be agreeable if you have hard to borrow stock in a cash account and can receive a fee for loaning out your stock. Then unlike IB very few firms will pay anything to retail investors.