I have often brought food onboard, but not purchased food. In my case it's that often I prefer to prepare my own food, particularly when I'm not sure what's onboard will be suitable to me. Crew has usually been very willing to accommodate me when I do this, at the minimum bringing service items so that I can eat off of a CE/CW tray whilst serving my own food onto plates they provide, and at a maximum having been happy to warm my stainless steel containers in the onboard warmers, and plate everything for me (that's happened a number of times or me in F, both on BA and AA).
Of course most of my travel for the last quarter century has been in F or J, but in my younger days (and also before so many different sorts of security bans) I took pleasure in self-catering my cheap Y flights with an assortment of foods that required no onboard preparation (smoked salmon over a salad, selection of excellent cheeses, etc.) To keep things civilised I always brought my own dishes and cutlery (latter now often not possible...). More than once on the long haul routes the crew were impressed with the spread I had served up and offered me a glass of wine from up in the front to accompany my cheeses. This was on UA but on a UA that hasn't existed in almost 20 years. If I brought some of those cheeses into economy now, I'd almost expect to be offloaded as a security risk.