Дома - is the remnant form of the old Russian Local case(местный падеж) which has not been retained in modern Russian.
In modern Russian such forms are considered to be adverbs.
See: "Морфология русского литературного языка. Наречие. Форма и значение наречий" (№ 36/2004 газеты "Русский язык" издательского дома "Первое сентября")
UPD По мнению Макса Фасмера, форма "дома" ("Я дома") является древней формой местного падежа. Реже эту форму определяют как форму Р.п., однако это маловероятно, так как историческим окончанием Р.п. слов склонения на -у, в которое входило слово "дом", было окончание -у (например, "из дому").
См.: Фасмер М. Этимологический словарь русского языка: в 4 т. Изд. 3-е. Т. 1 (А - Д). СПб., 1996. С. 526-527.
Я был дом
it would have a meaning ofI was a house
, whileЯ был дома
meansI was at home
. But why all this happens I cannot tell you definitely. The only thing I remember from the school is thatдома
in this case is (I don't know the correct terms for the next items in English)обстоятельство
(a circumstance) which isвторостепенный член предложения
(a subordinate member of a sentence) and must be always in an indirect case. For me it is obvious and what I'm used to, but it is hard to explain from the scientific point.на
orв
not used? I cannot get when you use a prepositional and when you use only genitive... And what is "indirect case"?дом
has at least two meanings, which area house, a home, a building
andhome
(in its broader sense, that is one's place of living, a place where one come from etc.). If you use a prepositionна, в, перед, под, к
etc. then the meaning will be the first onea house
. I would not vouch for the 100% correctness, but I think that the only preposition which is used withдом
in the second meaning (home
in its broader sense) isиз
(from
), when you sayиз дому
. But if you sayиз дома
(with A at the end) then the word has the first meaning (a house)Я был дома
it has the second meaning, that isI was at home