In RoboCop (2014), RoboCop tastes something in his mouth during brain surgery.
It tastes like peanut butter.
He is not eating any food. The surgery creates the experience of a phantom taste. Does this happen in real life?
Roughly speaking, taste is captured in our mouth but the signals are interpreted by our brain. Since Murphy is awake while the doctor pokes his brain (if he is poking the Gustatory cortex) it is possible that he induced the sensation of a specific taste.
as mentioned by @Mazura, Neurosurgeons at the Johns Hopkins Comprehensive Brain Tumor Center perform many brain tumor procedures while the patient is awake.
During surgery, the neurosurgeon will stimulate the area around the tumor with small electrodes. To precisely locate the functional areas of the brain that must be avoided, the neurosurgeon will ask the patient to perform tasks such as talking, counting and looking at pictures.
In the same way, the doctor could also ask the patient about taste and smell.
It seems that brain injuries or traumas can also cause changes in the sense of smell and taste.