When you are looking to purchase a home, you generally do not pay anything to the agent.

In most home sales, there is usually an agent that represents the seller and one that represents the buyer in the transaction.

The agent representing the seller charges them a fee to market, advertise etc, the home while they are working to sell it.  The home is also listed in the MLS and other systems that will get it local and national exposure.  The fee that the seller agrees to pay in the contract is split between the listing agent and the buying agent so the buyer does not have to pay for representation.