No, it is not illegal for a real estate agent to act as a buyers agent. What is illegal, is taking a commission off a seller as well as taking a fee off a buyer of the same property.
It would be better, in my view, to use an exclusive buyers agent to buy for you. i.e. one that does not list...