When activating the Stonemason mechanic where you overpay to gain two action cards of the value overpaid, the card SOMETIMES allows potion card purchases. Here's what happened:
Set had Stonemason and Apothecary. My opponent purchased a potion, I did not. When he purchased the Stonemason with 4 treasure and 1 potion, he was able to overpay and get two Apothecaries. Later, I purchased a Stonemason with 4 treasure and 0 potion, and the Apothecary was not listed as an option for me to gain from the Stonemason.
As the card text says nothing about "purchasing" the bonus card, I don't think that whether or not you have a potion in play should matter. I don't know if the official dominion rules allow you to gain a potion-costing card from Stonemason or not; typically those special gaining abilities EXCLUDE potion costs, but I don't know for sure in this particular case. Either way, the treatment of the Stonemason card should be consistent: Either "gain a card costing more than this" always includes potion cards or it always excludes potion cards, regardless of whether or not you have a potion in play.