Legality of buying stuff in bulk and reselling it myself?

Remember Costco started as a wholesale supply place. The whole intent was to sell to other stores. A lot of places resell their products.