Are you traveling internationally? On a domestic flight, if you can pack it carefully, you shouldn't have too much of a problem as long as you are not taking liquids.
Last year I took a Subway sandwich on the plane (that I bought outside the airport) and that was fine. I have also taken various other snacks, including cookies and muffins, and not had a problem. I would avoid buying items that
are liquid or nearly completely liquid (jams, jellies, honey, etc.) if you plan to carry them on the plane. I have seen items like that confiscated by airport security.
If you are traveling on an international flight, you will need to check the customs requirements and see if they will allow you to bring in food from the United States and how it needs to be wrapped. Some countries are more strict about this than others - it depends on the source as well as your destination. I visited New Zealand a few years ago, they have very strict agricultural and food quarantine laws. We had to throw out any food we had with us, even food they had given us on the plane. I think maybe a couple of people were allowed to take unopened, professionally pre-packaged processed foods, but that was about it. They even sent dogs around to sniff your suitcase. Australia and the US were much more lenient, and barely even asked what I had with me when they saw I was coming from New Zealand.
You might also ask when you are there (or call ahead) and see if you can arrange to have the store ship items to your house via UPS or Fedex or some other delivery service. It might be easier than trying to pack items and take them on the plane.