In the United States, wholesaling is completely legal. Wholesaling is effectively selling a property (or contract to buy a property), in which you do not intend to live, to an investor.
How you go about executing your transaction is the key. You have to learn what you can and cannot do in your municipality.