According to Catholicism, does purgatory refer to a place or state? Has it ever been described as a place and then later a state, or vice-versa?
In an appendix to Thomas Aquinas' Summa Theologica, Jean Nicolai, a 17th-century commentator on Aquinas, states that not much can be said about Purgatory, but he seems to imply that it is a place:
Nothing is clearly stated in Scripture about the situation of Purgatory, nor is it possible to offer convincing arguments on this question. It is probable, however, and more in keeping with the statements of holy men and the revelations made to many, that there is a twofold place of Purgatory. one, according to the common law; and thus the place of Purgatory is situated below and in proximity to hell, so that it is the same fire which torments the damned in hell and cleanses the just in Purgatory; although the damned being lower in merit, are to be consigned to a lower place.
At the same time, however, the Catechism of the Catholic Church seems to speak of it as a process or state:
All who die in God’s grace and friendship, but still imperfectly purified, are indeed assured of their eternal salvation; but after death they undergo purification, so as to achieve the holiness necessary to enter the joy of heaven.
The Church gives the name Purgatory to this final purification of the elect.
Every sin, even venial, entails an unhealthy attachment to creatures, which must be purified either here on earth, or after death in the state called Purgatory.
(paragraph 1472; emphasis added)
Pope St. John Paul II appears to have agreed:
Every trace of attachment to evil must be eliminated, every imperfection of the soul corrected. Purification must be complete, and indeed this is precisely what is meant by the Church's teaching on purgatory. The term does not indicate a place, but a condition of existence.
("General Audience of 4 August 1999", paragraph 5)
Finally, a 1979 letter of the Congregation of the Doctrine of the Faith gave a salutary warning:
When dealing with man's situation after death, one must especially beware of arbitrary imaginative representations: excess of this kind is a major cause of the difficulties that Christian faith often encounters. Respect must however be given to the images employed in the Scriptures. Their profound meaning must be discerned, while avoiding the risk of over-attenuating them, since this often empties of substance the realities designated by the images.
Neither Scripture nor theology provides sufficient light for a proper picture of life after death. Christians must firmly hold the two following essential points: on the one hand they must believe in the fundamental continuity, thanks to the power of the Holy Spirit, between our present life in Christ and the future life (charity is the law of the Kingdom of God and our charity on earth will be the measure of our sharing in God's glory in heaven); on the other hand they must be clearly aware of the radical break between the present life and the future one, due to the fact that the economy of faith will be replaced by the economy of fullness of life: we shall be with Christ and "we shall see God" (cf. 1 Jn 3:2), and it is in these promises and marvellous mysteries that our hope essentially consists. Our imagination may be incapable of reaching these heights, but our heart does so instinctively and completely.
("Letter on Certain Questions Concerning Eschatology", 17 May 1979)
Thus, it seems the appropriate answer is: The Catholic Church believes that we don't have enough information to talk with complete accuracy about the nature of life after death, perhaps including the decision whether Purgatory is a place or a state; it has used both descriptions as they have seemed appropriate, and most recently has tended towards descriptions as a state.
To the best of my knowledge, the details of purgatory have never been set out in an official Vatican document (like a papal bull, council decree, etc.). The magisterium of the church is somewhat vague on this point. (For some well-cited reading on various aspects of purgatory, see New Advent's Catholic Encyclopedia.)
Somewhat recently, however, Pope Benedict tried to shine some light on the matter. In a January 2011 talk about St. Catherine of Genoa, author of a treatise on purgatory, the pope agreed with the saint's conviction that "purgatory was not a place, but a process."
"'The soul that is aware of the immense love and perfect justice of God consequently suffers for not having responded correctly and perfectly to that love,' the pope said, adding that the suffering is purgatory."
The section Catholic Doctrine in the article Purgatory | New Advent has:
Purgatory (Lat., "purgare", to make clean, to purify) in accordance with Catholic teaching is a place or condition of temporal punishment for those who, departing this life in God's grace, are, not entirely free from venial faults, or have not fully paid the satisfaction due to their transgressions.
Therefore this article says Catholic Doctrine teaches that purgatory is a place or condition [state].
From my answer to What was St. Thomas Aquinas's view on the difference between punishment accorded to original sin and punishment accorded to individual sin? | Manwe Elder, St. Thomas Aquinas speaks of souls going to "abodes" and hence to him they go to places.
Purgatory is a place and a process. If you die in a state of grace, you go to Heaven. That doesn't mean you go directly to Heaven. If you still have some venial sin left in your soul, you make a pitstop in Purgatory to get the res of your sins out of your soul. "Nothing defiled can enter Heaven." (Apocalypse 21:27)
There is a famous story in the Bible from which it could be inferred that purgatory is not necessary for salvation. The complicated theological issue of purgatory's existence - which is the central theme of your question ("is it a place or state") - could therefore be avoided.
On Mount Calvary, one of the two thieves - sinners till the end of their lives - cried out to Jesus:
And he said unto Jesus, Lord, remember me when thou comest into thy kingdom. And Jesus said unto him, Verily I say unto thee, Today shalt thou be with me in paradise. (Luke 23: 42 – 43)
The Greek for “today” is σήμερον, sémeron, which according to Strong’s Concordance, also means “now”. Jesus answering in the affirmative implies He had had His Father’s confirmation of salvation for both of them at that instant, whilst they were still alive.
It is our complete faith in Christ that saves us, as per the exhortations of Paul the Apostle (Romans 10:8–10, New KJV):
But what does it say? “The word is near you, in your mouth and in your heart” (that is, the word of faith which we preach): that if you confess with your mouth the Lord Jesus and believe in your heart that God has raised Him from the dead, you will be saved. For with the heart one believes unto righteousness, and with the mouth confession is made unto salvation. (Romans 10:8–10)