The most common way is that the Vendor, Seller or Owner pays the commission to the realtor or broker at closing.
The Buyer or Purchaser does not have to pay any commission when buying property in Costa Rica, unless they specifically agreed to do so.