That is risk-taking. All entrepreneurs take risks and expect to be paid for the risk, as well as other costs, to produce the product. In the market system someone's income is another one's expense. Anytime buyers and sellers come together, a market is created. Buyers are careful about how much they are willing to pay for a product, often shopping around for the best price for their money.
Suppliers respond in the same way by moving to a price where there are no leftovers or shortages.
Buyers of the cookies will be willing and able to purchase more cookies at a low price and fewer cookies at a high price. This happens because, at higher prices, cookie buyers' dollars purchase less than at lower prices. Economists call this the income effect. Cookie consumers are more willing to buy cookies at low prices. At high prices, cookie consumers look for other products to buy instead, such as ice cream, Popsicles, or candy bars.