Assuming I'm understanding this correctly, atá = a + tá ... these sentences are all using "tá + preposition to mean "to have", the question words require the 'a' to indicate... that there's an object to them? I don't remember what the word is that refers to this.
So you're saying "How much (of that thing) do you have?" ... so you have to use the "a" (to mean "of that thing"), but because it's followed by "tá", you smoosh the words together to form "atá".
'cá mhéad atá agat?' means 'how much do you have?' it's the '-at' at the end of 'agat' that tells us it's how much do 'you' have.
i'm not totally sure how to say 'how much is this?' but if 'how much does it cost?' is close enough, you can say 'cá mhéad atá air?' substituting 'air' for 'agat' changes the meaning from how much do 'you' have? to how much is 'it?' (in english, sometimes we say, 'how much do you have on you?' or even less formally, 'how much you got on you?' well, 'cá mhéad atá air?' is kind of like asking, 'what's the price of it?' or 'what's the price on it?')
now, if you want to specify 'it' by name, you can replace 'air' with 'ar + whatever it is.' 'how much is a cup of coffee' would be cá mhéad atá ar chupán caife?'
the part i'm less sure about is how to say what you originally said, 'how much is this?' but i think you could add 'seo:' 'cá mhéad atá air seo?' that's the one i'm not sure about; because, it kind of 'feels' like i need to 'reference' that 'seo;' that is, 'how much is this one?' instead of 'how much is this?' in which case i'd feel pretty confident about 'cá mhéad atá ar an gceann seo?'
i really like phrases such as 'cá mhéad atá agat orm?' which means 'how much do i owe you?' or 'cá mhéad atá agam ort?' which means 'how much do you owe me?' i used to mix those up all the time, until i learned 'tá deoch agat orm,' which means, 'i owe you a drink;' as long as i remember that phrase, i can remember that 'agat orm' is 'i owe you,' and 'agam ort' is 'you owe me.'