I understand it is not allowed to buy or sell on Yom Tov. But since it seems that buying food (say, I forgot or had no time to buy it before) is a Melacha that can be done for the Yom Tov use, could you explain wider why no exception applies? Are there stricter and more lenient opinions on the matter, or is there full agreement about this among halachic authorities?
The Torah allowes on Yom Tov Milachot that are done for Ochel Nefesh, like cooking food on Yom Tov for Yom tov use. The Talmud Teaches us that some Milachot of Ochel Nefesh are still forbidden for various reasons (each case can have a different reason). Buying food according to all authorities is not allowed. Our rabbis teach us that if we allow buying and selling one can accidentally come to write on Yom Tov which is a Milach De'orita. Rabbi Binyamin Bamberger