J.M. yes, there are in-line backflow preventers, made just for that purpose. Normally this would be installed just before the main line leaves the basement/crawlspace, or if your line is shallow, it can be located just outside. From my recollection, they should be placed where they can be accessed in case of a problem.
You can get them at most plumbing wholesale houses.