The answer may very between cities and district to district. But I think most schools allocate some space for "out of district" students.
In any case priority given to accommodate students that live in the district. It really depend on what is the capacity and attendance of the particular school.
I live next to a very good elementary school. They used to accept students outside of the district based on first come first served. Then things got out of hand and people started to lineup 24 hr. before registration open day. Now they have a lottery for the open spaces (spaces also became scarce)
Contact the school and or the district you are interested in and find out how they handle out of district registrations.