when was grandfather clause passed was it state or federal law

when was the grandfather clause passed? was it a state or federal law?