Most realtor professional services to the buyer are covered by the seller during the closing in the form of the commission from the sale.  The final split is usually predetermined when the house is listed.  The real estates brokerage that your realtor is contracted with collects this and then they finally pay your realtor.

The buyer is usually responsible for any fees up front for building inspections or surveys that the buyer would like to have done before the sale is complete.

This is why realtors will tell you that their services are offered free to the buyer since their compensation comes from the actual sale of the property usually from the seller side of the deal.

This is also why realtors will ask you to sign an agreement with them.  This is the only way for them to collect any pay for helping you in your home search and is usually required by state laws to have an agreement in writing in order to be compensated.

This agreement also protects you as a buyer because that agent has an obligation to you keeping your best interest at heart.  This means that even if their cut of the commission is lessened by a lower sale price that is what they will do for you.  After all, the agents best friend is you as a source of referrals for the future of their business.