Whether or not it's legal depends on what state you're in and what their agency laws say.
In Tennessee where I practice real estate such behavior by a licensee would be illegal.
http://www.kaarmls.com/ "Duty owed to all parties ( TCA 62-13-403 )
“A licensee who provides real estate services in a real estate transaction shall owe all parties to such transaction the following duties, except as provided otherwise by TCA 62-13-405, in addition to other duties specifically set forth in the official manual of the Tennessee Real Estate Commission or the rules of the commission:
7. (a) Not engage in self-dealing nor act on behalf of licensee's immediate family, or on behalf of any other individual, organization, or business entity in which the licensee has a personal interest without prior disclosure of such interest and the timely written consent of all parties to the transaction."
If her behavior and actions are as you described they would also seem to be in conflict with the Realtor's Code of Ethics:
http://www.realtor.org/mempolweb.nsf/pages/code "Duties to Clients and Customers
"Article 1
When representing a buyer, seller, landlord, tenant, or other client as an agent, REALTORS® pledge themselves to protect and promote the interests of their client. This obligation to the client is primary, but it does not relieve REALTORS® of their obligation to treat all parties honestly. When serving a buyer, seller, landlord, tenant or other party in a non-agency capacity, REALTORS® remain obligated to treat all parties honestly. (Amended 1/01)"
I'm guessing you probably did not have any sort of written agency agreement with her and if that's the case she wouldn't have any agency duties to you but would remain obligated to treat you honestly.
Your recourse would be filing a complaint with that state's real estate commission and/or her local board of Realtors.
There may be some other legal recourse as well; I would advise you to consult with an attorney about that.