From what I've found so far, there was some association with free masons but likely for the building of the temples. JS was not himself a mason. I did find something in my Encyclopedia of Joseph Smith's Teachings.

Heber C.Kimball said: "There is a similarity of priesthood in masonry. Brother Joseph (Smith) says Masonry was taken from priesthood, but has become degenerated." (Stanley B. Kimball, Heber C. Kimball: Mormon Patriarch and Pioneer, p.85, standardized.)

Words of Benjamin F. Johnson: He (Joseph Smith) told me Freemasonry, as at present, was the apostate endowments, as sectarian religion was the apostate religion. (Johnson, My Life's Review, p. 96).

I also found where Joseph allowed lodge meetings in his office. My assumption is that the association in the first place (why they were around) was for building purposes. Joseph Smith oversaw the building of 2 temples during his life - not an easy task then. They definitely utilized skilled artisans....

I didn't know about this, but was apparently right about all that with my statement some ways back about thinking they were trying to hold onto something precious that was lost through the ages. It was, however, lost as was the authority of the priestood and in the process, changed. I mentioned before, too, that my father-in-law associated with them...but he was not a member of the church. But I do believe all in all its original purpose was motivated by good (masons). I know nothing about the pagan rituals the movie portrays (The DaVinci Code) and so you know our temple ordinances are nothing like that.... Having said that I won't discuss temple ordinances in this forum. They are considered sacred and I don't want to have them held up for ridicule.