Catholic canon law has forbidden membership in Masonic organizations since 1738, with Pope Clement XII's papal bull In eminenti apostolatus.
Those who join a Masonic sect or other societies of the same sort, which plot against the Church or against legitimate civil authority, incur ipso facto an excommunication simply reserved to the Holy See.
Since the new canon law did not specifically mention Masonry, any issues or questions about Roman Catholics with Masonic associations were clarified by the Sacred Congregation for the Doctrine of the Faith.
[...] In an audience granted to the undersigned Cardinal Prefect, the Supreme Pontiff John Paul II approved and ordered the publication of this Declaration which had been decided in an ordinary meeting of this Sacred Congregation.
In the Letter to U.S. Bishops Concerning Masonry dated April 19, 1985, Cardinal Bernard Law affirmed Ratzinger's proclamation and reiterated the ban on all forms of freemasonry.