In the following examples, I'm not looking for what is "socially accepted" or "standard use" so much as I am just curious about the precise, grammatically correct answers. Take a sentence like "We went to the store." The subject is "we." However, we also frequently hear sentences like "All of us went to the store." Does using "of" turn an object pronoun into a subject pronoun? Or are we just accustomed to bad grammar? Another example: "They all bought candy," vs "All of them bought candy." "All of they bought candy," just sounds awkward, and I don't expect anybody would use it. But is "All of them bought candy," despite being common structure, grammatically correct as a sentence? Or should "They all bought candy" always be the preferred syntax?
Ok, so in your examples: All of us went to the store. All of them bought candy. They all bought candy These are all correct, both grammatically and also idiomatically (the way people speak day to day). What's happening is the following: Sometimes a noun or an adjective is really a conglomerate of words functioning together; hence, we have terms like noun phrase and adjectival phrase. They have to be considered as a unit and sometimes there are internal dynamics to the unit that prevail over what one might intuit. All of us went to the store. In this above sentence the core subject has actually shifted to all, and is no longer we or us. All is the subject being modified by the propositional phrase of us and the three words compose a noun phrase, a single unit, within which all is the grammatical subject and us is the logical subject. They all bought candy. In this sentence, they remains the subject - both grammatical and logical - and all serves as a reduplicated pronoun that serves only to add emphasis of totality and full inclusion. All of they bought candy. This last example is wrong both grammatically and also idiomatically. It is not a construction anyone would create or use in any speaking region with which I am familiar.