In many countries the prisoner may select what the last meal will be (within reason), and the authorities do their best to satisfy the request.
Although the history of this tradition is difficult to trace, most modern governments that execute prisoners subscribe to it.
The ancient Greeks, Chinese, and Romans all traditionally gave the condemned man a final meal. The Aztecs fed their human sacrifices for up to a year before killing them.
In pre-modern Europe, granting the condemned a last meal has roots in superstition: a meal was a highly symbolic social act. Accepting freely offered food symbolized making peace with the host. The guest agreed tacitly to take an oath of truce and symbolically abjured all vengeance. Consequentially, in accepting the last meal the condemned was believed to forgive the executioner, the judge, and witnesses. The ritual was supposed to prevent the condemned from returning as a ghost or revenant to haunt those responsible for their killing. As a superstitious precaution, the better the food and drink, the safer the condemned's oath of truce. Last meals were often public, and all parties involved in the penal process took part.
There were practical side effects of a peaceful last meal as well. It was crucial for the authorities that a public execution was a successful spectacle. If the mob believed something was wrong, things could get out of hand and place the condmned's guilt in doubt. The condemned's solemn last meal symbolized that they accepted the punishment. Additionally, prisoners were often served large quantities of alcoholic beverages to soothe them and bar them from execrating the authorities while ascending the scaffold. In Ancient Japan, samurai warriors would sometimes commit seppuku (ritual suicide) for a variety of reasons. Before the suicide, the Samurai would be served their favorite foods.
In the United States, most states give the meal a day or two before execution, and use the euphemism "special meal". Alcohol or tobacco is usually denied. An unorthodox or unavailable request will be replaced with a substitute. Some states place tight restrictions. For example, Texas limits last meals to food available within the prison system, though occasionally permitting food "from the free world". In Florida, the food for the last meal must be purchased locally and the cost is limited to $40.
Some prisoners have elected to share their last meals with another inmate (like Francis Crowley did with John Resko), or have the meal distributed among other inmates (like Raymond Fernandez).