(Translation of an answer in Russian)
This is an example of Partitive (частичного падежа). It is rarely used in Russian, usually with nouns that mean food or drinks.
Выпить воды (not all the water, but some water)
Поесть хлеба (some bread)
Выпить коньяку (some cognac)
Partitive usually matches Genitive case, but most masculine nouns like чай (tea), коньяк (cognac), бензинчик (gasoline), etc., have two forms of Partitive: чая/чаю, коньяка/коньяку, бензинчика/бензинчику. Both variants are correct, but second one (that matches Dative case) is colloquial.
So, in second case, in a sentence
Можно мне ещё чая/чаю?
Both variants are correct, because Partitive is used. However in case of "Я бы не отказался от чашки чая" the noun should be in Genitive case and so the correct form should be
Я бы не отказался от чашки чая.