Loan officers are paid for their expertise and experience in helping mortgage consumers aquire financing. They are paid in two ways - either from you, or from the lender (or both).
Most loan officers charge what is called an origination fee or a mortgage broker fee. This is usually their main source of money that they get paid from. Very few loan officers get paid this full amount, but instead get paid a certain percentage of this amount depending on the company they work for and their pay agreement that they have with this company. Most loan officers are 100% commission although there are some who get small salaries along with smaller commission percentages.
Some loan officers who work for larger national banks and lenders get paid a small base percentage on the total dollar loan amount they close each month. This becomes a volume based business and helps to explain why using a mortgage broker will ultimately get you better service. With the loan officers at larger banks and lenders you may be one of the 100+ calls they made or received that day, and you may be one of 100 loans they are working on for that month. While with a mortgage broker you could be one of 5-10 people they are working with at that time. Your business is more important and you get better customer service because you are not just a number.
Loan officers working for mortgage brokers are usually 100% commission based, meaning they only get compensated if they can help home buyers acquire home financing. This compensation set up is designed so that loan officers have monetary incentives to help home buyers.