This is really a misleading expression often used by English speakers both in writing and speaking.
What a Shame is different from Shame on You. But very often it leads to misunderstanding.
Primarily, we mean by shame as an emotion resulting from awareness of having done something disrespectful or some unworthy, degrading acts. Interestingly, the word has got as many as 15 meanings, yes fifteen, you heard it right. It is used in various ways in various contexts.
Let’s discuss those meanings:
1) A painful sensation excited by a consciousness of guilt or impropriety or of having done something which injures reputation or of the exposure of that which nature or modesty prompts us to conceal.
2) Reproach incurred or suffered; dishonor; ignominy; derision; contempt.
3) The cause or reason of shame; that which brings reproach and degrades a person in the estimation of others; disagree.
4) The parts which modesty requires to be covered; the private parts.
5) To make ashamed; to excite in (a Person) a consciousness of guilt or impropriety or of conduct derogatory to reputation; to put to shame.
6) To cover with reproach or ignominy; to dishonor; to disagree.
7) To mock at; deride.
8) To feel shame.
9) An unfortunate development.
10)A painful emotion resulting from an awareness of inadequacy or guilt.
11)A state of dishonor.
12)Surpass or beat by a wide margin.
13)Cause to be ashamed.
14)Compel through a sense of shame.
15)Bring shame or dishonor upon.