The belief that John the Baptist was freed from sin in his mother’s womb is a pious sentiment that is taken from the scriptural account of the Visitation in Luke 1:41-44 when the Holy Spirit indwells Elizabeth and prompts her baby to recognize the unborn Christ Mary is carrying. It is not an official teaching or doctrine of the Church.
Only Christ was born of a virgin birth. Mary was born as the result of ordinary marital relations between her mother and father. It is possible that there is confusion of the Virgin Birth with the Immaculate Conception. The Virgin Birth is Christ’s birth from a virgin. The Immaculate Conception is Mary’s preservation from the stain of original sin.