I don't think that Pope Pius IX could have been a freemason. He stood up against them too much and was very hated by them...
And if I remember correctly, Saint Bernadette of Lourdes claimed that one of the primary reasons that Our Lady appeared was to support Pius IX and confirm the decisions and proclamations made by him.
He made some politically liberal moves at the beginning of his reign, to the celebration of the ʝʊdɛօ-masonic world and against better advice, including from Von Metternich of Austria. Yet after being forced to flee during the 1848 revolutions he spent the entirety of his Pontificate staunchly against liberalism and the Church's enemies that there is even speculation that one motivation of the Franco-Prussian War by Bismarck was to stopped Vatican Council I (France withdrew their troops and Rome was taken). So his actions did contribute to the unfortunate loss of the Papal States but that in no way makes him a Mason, just made poor political decisions early in the first couple of years.