This is not easy to decide and another Wikipedia article notes that the matter would be 'disputed among historians'. A lot of maps depicting the medieval empire include those lands, other do not. The contemporary Imperial Register (Reichsmatrikel) lists contribtions to be made from the order, but only for the western bailiwicks, not the Prussian lands.
The Golden Bull of Rimini uses language that might imply making the Grand Master into a prince of the empire:
- Adicimus insuper et gratia nostra, quod idem magister et successores sui iurisdictionem et potestatem illam habeant et exerceant in terris suis, quam aliquis princeps imperii melius habere dinoscitur in terra, quam habet, ut bonos usus et consuetudines ponant, assisias faciant et statuta, quibus et fides credentium roboretur et omnes eorum subditi pace tranquilla gaudeant et utantur.
(src)
Or language that does plainly state such:
The bull declared that the whole country was part of the Roman-German Empire.
(deWP)
We [that is, Frederick himself] therefore... especially because the land itself is held under the sole rule of the Empire (sub monarchia imperii), trusting also in the judgment (prudentia) of the same Master, because he is a man mighty both in deed and word and through his own and his brethren's perseverance is mightily undertaking and manfully carrying out the conquest of that land... even though many, vainly besought with numerous exertions in this business, gave up (defecerunt) just when they seemed about to set forth, grant the land of Prussia to the same Master along with the forces of his order and with all those who think to invade [it]…
(enWP)
But this conflicts with two other facts.
The first would be that in the Golden Bull of Rieti (Pietati proximum) the pope claims sovereignty over the Teutonic Order and its lands, while at the same expressly forbidding any other feudal relationships for it.
The German Orders should answer exclusively to the sovereignty of the Pope.
(enWP)
The second is mainly raised by Polish historians, namely that the emperor wouldn't have had the right to make a fief out of lands he did not control in the first place.
Whatever the origins and real or alleged legal basis for any developments there, or from even clear and present forgery (cf privilegium maius) what's relevant is what they made of it, in other words: real world consequences.
And these were ever so complicated in a Schrödinger-cat-like hybrid status of the whole entity until the end of the medival period, in practice, for a lot of check-boxes, but apparently not all, it was part of the empire de facto :
The internal reason for the independence of the Protectorate of the Teutonic Order from that of the German nation (and also from the Polish protectorate) lies in the canonical and constitutional status of the Teutonic Order and its Grand Master. The land of the Teutonic Order probably formed a part of the German Empire, but its attachment to the Empire was not a feudal relationship. And even though the Order as an order of knights was inwardly close to feudal law, it saw itself bound by the papal prohibition of feudalism, just like the Order of the Temple and the Order of St. John. Conversely, the papal protective privileges rather speak of an ecclesiastical feoff of the Order with Prussia and have only strengthened the papal protectorate over the Order).
According to this, the Grand Master of the Order did not belong to the vassals of the empire due to his passive feudal incapacity, and was therefore not a prince of the empire. Thus it is also understandable why the Grand Master and the Order were not subject to the German protectorate, just as the bishops of the Empire who were princes of the Empire and whose dioceses belonged to the protectorate of the German nation. As a result of this peculiarly "autonomous" position of the country of the Order, which on the one hand – but not as a performing member – belonged to the Reich, but on the other hand was again under papal protection, the Teutonic Order was able to form a Cardinal Protectorate, which was both an Order Protectorate and in some respects can be counted as a Land Protectorate.
The Cardinal Protectorate of the Teutonic Order existed until the secularisation of the Order's land in 1525, but the Order, which continued to exist in its German and welschen bailiwicks and was confirmed and protected by Charles V, no longer had a protector. This is all the more striking as the other order of knights, which has survived to the present day, the sovereign Order of St. John (Rhodesian, Maltese), retained its protectorate. And yet this is a logical position of the Roman Curia. For when the last Grand Master of the Order, Albrecht of Brandenburg, became "princeps vasallus" of the Polish King as Duke of Prussia, the German Master Walter of Kronberg, who ruled the bailiwicks of the Empire, was enfeoffed with Prussia by the Emperor in 1530 and at the same time raised to the rank of prince. As the ecclesiastical prince of the empire, he was previously subject to the German protectorate. The protectorate of the Teutonic Order had lost its meaning. Thus in 1575 Cardinal Lodovico Madruzzo, as Protector of the German Nation (and Chairman of the Congregatio Germanica), intervened in the affairs of the Teutonic Order's Commandery in Pavia, although no mention is made anywhere in the entire course of negotiations with the Pope of his own Order Protectorate.
— Josef Wodka: "Deutschordensprotektorat und Protektorat deutscher Nation", Zeitschrift der Savigny-Stiftung für Rechtsgeschichte: Kanonistische Abteilung, Vol 34, Issue 1, 1947.
A more practical approach simply asserts
The emperor was hardly involved in either colonization or the Northern Crusades, which, together, achieved the largest expansion of the Empire since Charlemagne. Although Frederick II issued his own authorization to the Teutonic Knights, the Order acted independently in carving out its own state, which eventually succumbed to a resurgent Poland around 1500. Secularization of the Order’s territory in Prussia by the (then) relatively insignificant Hohenzollern dynasty in 1525 did not affect its other possessions, which were grouped into 12 bailiwicks across the Rhineland, south and central Germany, and Austria. The Order retained its crusader privileges, making membership highly attractive for German nobles. Any land donated to it was immediately freed from previous debts. The senior Grand Master remained based in Germany and had been raised to the status of imperial prince in 1494, followed by his counterpart in the Knights of St John in 1548. These elevations integrated both Orders and their leaders into the imperial church, with their lands becoming immediate imperial fiefs, though the Knights of St John remained part of an international organization based in Malta. The Teutonic Grand Master remained Catholic, but the Order accepted Protestant nobles after the Reformation.
The Salians’ efforts to assert suzerainty over Poland and Hungary failed just as demographic and economic growth in the Empire gathered momentum, prompting a resumption of eastward expansion suspended since the 980s. The subsequent Wendish Crusade after 1147 involved Bohemians, Danes and Poles, but is associated in the popular memory primarily with the Teutonic Order. This was a self-consciously Germanic organization, but was highly unusual in the much wider process of migration and in fact did not require its knights to be born Germans and made little effort to Germanize its multi-ethnic subjects ‘beyond enforcing the most perfunctory Christianization’.
The Order kept its relationship to the Empire deliberately ambiguous. Grand Master Hermann von Salza negotiated purposely contradictory agreements with Emperor Frederick II, Pope Gregory IX and the Piast Prince Conrad of Masovia in return for agreeing to assist the northern crusading effort in 1226. His agreement with Frederick secured the emperor’s sanction and protection, whilst guaranteeing the Order’s independence as only the Empire’s ‘associate’ rather than vassal.
Utterly ruthless, the Order continued its aggressive expansion long after achieving its original goal of defeating the pagan Prussians. It exploited Poland’s internal divisions into the 1320s to expand at the expense of fellow Christians, including capturing Gdansk in 1308, as well as buying Estonia in 1345 from Denmark, which had conquered it during the 1220s. Suzerainty was extended over the archbishopric of Riga in 1395, reducing the parallel Livonian Order to a subordinate branch.
1226 —
The Golden Bull of Rimini granted secular jurisdiction to the Teutonic Order for lands it was conquering in the Northern Crusade against pagan Slavs along the south-eastern Baltic shore. This established the basis for the future Teutonic Order state in Prussia, which was considered part of the Empire but not an active part of the German kingdom.
— Peter H. Wilson: "Heart of Europe. A History of the Holy Roman Empire", Belknap Press: Cambridge, 2016.
So, in a very short summary:
The duchy of Prussia, which until the beginning of the sixteenth century was ruled by the Teutonic Knights, had formed at different points in its history feudal ties both to Poland and to the Holy Roman Empire. During the Reformation, Albert, the Grand Master of the Teutonic Knights, secularized the duchy, and from then on it was a fief of the Polish crown, not the emperor.
— Barbara Stollberg-Rilinger: "The Holy Roman Empire. A Short History"
Princeton University Press: Princeton, Oxford, 2018.