In some cases it depends on the real estate you intend to buy.
For example, many banks, when selling their foreclosures will not allow the listing agent to represent both sides. The bank recognizes a great potential exists for which they can be taken advantage. They choose the listing agent and the buyers agent be different, and some even from different offices.
Of course YOU can choose to use the listing agent in the purchase.
Please be aware, the listing agent represents the seller, not the buyer..
It is possible you have more resources than the banks and know more than the listing agent.
However, prevailing wisdom suggests you should have an agent with a duty to represent your best interests and direct you away from decisions harmful to you.
Some want to believe they will save money using the same agent. If you think you know more than the bank and the listing agent, then pursing the illusion of saving is all the permission you need.
Repeating, you don't need two agents to buy and sell real estate, but prevailing wisdom and practice establish an agent whose sole purpose is the represent the buyer to be the best policy to follow.