1. What is the purpose of Allah in making alcohol haram?
Because of reasons that are stated in Quran:
إِنَّمَا يُرِيدُ الشَّيْطَانُ أَن يُوقِعَ بَيْنَكُمُ الْعَدَاوَةَ وَالْبَغْضَاء فِي الْخَمْرِ وَالْمَيْسِرِ وَيَصُدَّكُمْ عَن ذِكْرِ اللّهِ وَعَنِ الصَّلاَةِ فَهَلْ أَنتُم مُّنتَهُونَ
Satan only wants to cause between you animosity and hatred through intoxicants(*) and gambling and to avert you from the remembrance of Allah and from prayer. So will you not desist?
Maide 91 (5/91)
I don't know why they translated "خمر" as intoxications, but خمر means "wine, vintage, booze, brew, ferment", and means "drinks that make you drunk" in general.
According to this ayat, the reasons stated in Quran are:
- Alcohol makes hostilities (الْعَدَاوَةَ) among us.
- Alcohol spreads hatred (الْبَغْضَاء) among us.
- Alcohol averts us from the remembrance of Allah (ذِكْرِ اللّهِ).
- Alcohol averts us from prayers (الصَّلاَةِ).
(Actually, the word "salat" means more than just "prayer". It literally means "supporting", as a term it means "supporting the way of Allah through education". The basic practice know as "prayer" is only a kernel of salat. It consists of parts (rakats) in which we read Quran and do ruku (bowing) and sacde (prostrating) to show our obedience. The kernel of our prayers is reading Quran, in a wider meaning it is education. So, in this ayat, Allah also means/implies that alcohol obstructs education.)
2. Is it ok to drink alcohol if that purpose is still met?
No. When Allah orders something, it becomes a must. We cannot decide back doors with our own minds. Allah prevents us finding our way with our own minds.
وَلَوِ اتَّبَعَ الْحَقُّ أَهْوَاءهُمْ لَفَسَدَتِ السَّمَاوَاتُ وَالْأَرْضُ وَمَن فِيهِنَّ بَلْ أَتَيْنَاهُم بِذِكْرِهِمْ فَهُمْ عَن ذِكْرِهِم مُّعْرِضُونَ
But if the Truth had followed their inclinations, the heavens and the earth and whoever is in them would have been ruined. Rather, We have brought them their message, but they, from their message, are turning away.
Muminun 71 (23/71)
3. There are cough (and other) medicines which contain alcohol. They are not wine or something like that. Is it ok to take that medicine in cough?
About good usages of alcohol:
يَسْأَلُونَكَ عَنِ الْخَمْرِ وَالْمَيْسِرِ قُلْ فِيهِمَا إِثْمٌ كَبِيرٌ وَمَنَافِعُ لِلنَّاسِ وَإِثْمُهُمَآ أَكْبَرُ مِن نَّفْعِهِمَا وَيَسْأَلُونَكَ مَاذَا يُنفِقُونَ قُلِ الْعَفْوَ كَذَلِكَ يُبيِّنُ اللّهُ لَكُمُ الآيَاتِ لَعَلَّكُمْ تَتَفَكَّرُونَ
They ask you about wine and gambling. Say, "In them is great sin and [yet, some] benefit for people. But their sin is greater than their benefit." And they ask you what they should spend. Say, "The excess [beyond needs]." Thus Allah makes clear to you the verses [of revelation] that you might give thought.
Bakara 219 (2/219)
Allah says that "the things that make you drunk" (خمر - khamr) has also good points.
When we read the entire Quran, we get an impression that Allah loads less responsibilities to diseased people.
4. Some foods in which a little amount of alcohol is mixed to make the food soft and cook earlier. Alcohol is volatile and evaporates on heating. Is it ok to eat that food?
If there is no alcohol in the final form of the food, then there is no problem. But, some alcohol may have remained in it. A Mumin (believer) must be cautious and finicky. Allah's orders comes before anything else. So, I personally would avoid any food that was prepared with alcohol.