When buying a home, the buyer normallly chooses their own lender. When you buy a home, you should shop lenders and compare their rates. You will decide which lender to go with.
If the buyer is purchasing a REO (a property owned by the bank), the bank can not dictate which lender the buyer uses. However, the bank can require buyers to prequalify with a particular lender. Ultimately, the buyer can use whoever they want to finance their loan, but they will need to get an additional prequal letter from that lender in order to submit an offer.
A non-REO seller (anyone other than a bank), as part of their negotiations, can require a buyer to use a particular lender if they want to buy the property. This is absolutely legal. A seller may choose to do this because they trust a particular lender and they will feel more comfortable that the deal will go through. If the seller does not make this requirement, then the buyer can move ahead with their own lender.