Prussia was both a state and a country! Until 1701, it was a state; part of it (March of Brandenburg) belonged to Germany and the other (Duchy of Prussia) to Poland. Although technically the two halves were still separate (ie, "Prussia" only referred to the Duchy) and Brandenburg (as an Electorate) outranked Prussia.

After 1701, it was both state and country; that part of its holdings that fell within the Holy Roman Empire (Brandenburg, Duchies of Cleves & Pomerania, etc.) were still imperial fiefs (held from the Holy Roman Emperor). But the Duchy of Prussia itself was now a Kingdom, free of any feudal ties to Poland.

So after 1701, the King of Prussia was a sovereign monarch "in" Prussia, but as Elector/Margrave of Brandenburg, he was still a vassal of the German Emperor. This lasted until 1806, when the Empire was dissolved. Henceforth, the King of Prussia was no one's vassal for any of his lands.