Dr. Chattopadhyaya has done a wonderful job presenting the theory that in the earliest days proto-Tantra and proto-Lokayata were a single system, which either originated or was most prevalent in northeast India. His argument rests on a theory of magic as a necessary precondition of religion, similar to the theories of anthropologists such as Andrew Lang and J.G. Frazer:  
The theory goes as follows: magic precedes, and then accompanies religion in early human societies. Magic does not necessitate Gods; it is simply an attempt for early humans to manipulate the forces of nature without knowing the actual mechanisms of how nature works. For example, it makes sense for someone ignorant of physics, chemistry and the hydrologic cycle to attempt to generate rain by ritualistically pouring water on the ground and calling to the sky. It is worth experimenting with at the very least. In this sense, magic is a sort of proto-science.
The problem is that when these magic practices are empirically tested over generations, most of them will be found ineffective. Yet still perceiving order and regularity, the population generally will infer that other conscious agents called Gods are in control, and will adapt their magical beliefs and practices into a theistic system. By this process the magic becomes a religion, and “experimental” processes ossify into religious rituals.
The magic underlying Hindu religion is evident in all the early texts. The Rig Veda contain a huge number of passages asking the Gods for purely material things such as cattle, crops, prosperity, or protection from the elements.    These are likely magic rituals to induce crops, or protect cattle adapted into a theistic framework. Other passages frequently identify the Gods as a “powerful chief” “foremost amongst men,” “the bravest among all humans” (In the case of the Rbhus, this is made explicit: being mortals they earned immortality”, RV, I.110.4) which is perhaps a clue that these first Gods were in fact God-kings or the deified spirits of ancestors, who were perhaps thought to be able to control physical processes from the next world. The Arthava Veda consists almost entirely of magic techniques, mantras and rituals, not dissimilar from what we find in Tantra. Several early Upanishads also espouse a belief in the magic power of breath manipulation.   It seems likely that many of these writings exist because early experimenters with meditation found them to be materially effective in inducing samadhi states. In other words, early meditative practices can be thought of as successful early attempts at quasi-scientific experimentation with the human body and brain. Sinha argues that the materialist trend represented in the Vedas culminated in Lokayata in the 7th century BC. As evidence he cites many examples similar to those above, but also emphasizes the fact the in the Vedic canon, the progenitor of materialist philosophy is the deified guru named Brihaspati. Another word for Lokayata is Brihaspati Darsana.