Are you able to loan money from your life insurance?

I thought i remember my insurance agent telling me that if you needed to loan money from your policy you can and you pay so much interest. If so how much could you borrow..is it what you put in to it so far or what the life insurance policy amount is? How much time do you have to repay them?