Since 1618 the dukes of Brandenburg (the hohenzollerns) had ruled Prussia in a personal union, with Prussia being outside the traditional limits of the Holy Roman Empire. At the time only two royal titles were permitted inside the empire. The King of the Germans which was helped by the emperor and the title King of Bohemia. Therefore to get around this the king made himself King in Prussia which was outside the boundaries of the empire. This creates the legal fiction that he was only sovereign over his Prussian lands while remaining subservient as elector under the empire in his Brandenburg lands. This same reason allowed Augustas II when elected king of Poland to retain the title king of Poland as it was outside the empire
If your curious about Prussian history I can not recommend enough my source for this comment Iron Kingdom by Christopher Clark
Expansion as Requested by Captkrob and now that I am not on my Phone.
Another one of the issues is that the Title "King in Prussia" was a new one. Prior to the elevation the title was simply "Duke of Prussia". Fredrick in 1701 had decided that his expanded realm was needing of an expanded title to king. In return for support during the War of Spanish Succession, the Emperor Leapold I allowed him to create the new title as long as he kept to the legal fiction mentioned above. Also Poland themselves held the Duchy of Royal Prussia which would prevent Fredrick form being "King of Prussia" as that implies sovereignty of the entire Prussian Region. As well as the fact the Kings of Poland styled themselves the Kings of Prussia until 1742. The title was only changed from King in to King of in 1772 when most of Royal Prussia was annexed during the first Partition of Poland.
However when Augustus was elected King of Poland (arguably he lost the election to the Prince of Conti but he quickly advanced into Poland with a Saxon army) the title (King of Poland)was in existence from 1025. Therefore rather then asking permission to create a new title Augustus imply assumed a title that had been in existence for hundreds of years by this point. Its helpful to think of the titles as separate entries bound in a single person. While as the Duke of Saxony Augustus held nominal Vassalage to the Emperor the Kingdom was a fully sovereign nation. Therefore rather then a vassal creating a new title for himself Augustus was assuming a title already in existence with all the legal protections this came with. Also as captkrob mentioned Austria (and Russia) championed Augustus' election for the throne so they wouldn't do anything to hurt his chances or upset his reign at the time.
The question essentially boils down to "why did the Hohenzoller only call themselves King IN prussia". The Wettins called themselves "King in Poland" because that was the traditional title.
But why then would the Hohenzoller create a title called "King in Prussia"?
One thing that was mentioned, the Kaiser didn't want to make the impression that he would "create" a royal title within the Empire (which could be seen as a loss of authority of him); the Elector, on the other side, wanted the title to underline that he was more than a mere Reichsfürst, a potentate under the Emperor, that he was a powerful monarch in his own right. And Prussia was, as others said, not within the Empire, so why not take it as basis for the new title?
In the end, the Elector paid a lip service to the seniority of the Emperor "as highest monarch of Christendom", which was even then a shallow phrase and had no legal rammifications.
And it was made clear that the Elector created a new title outside of the Empire, which the Kaiser only acknowledged. The Kaiser mainly had to accept this because it was clear that he would soon need the help of Prussia in the War of the Spanish Succession, the agreement between the Kaiser and the Elector (the Krontraktat) specified that the Elector had to support the Kaiser with 8000 men, and the Kaiser would help the Elector to get international and national (within the Empire) recognition. The King of Poland, August II., der Starke (who was a Wettin and Elector of Saxony) had certainly other things to do than to cut down Prussia; he was busy fighting against Sweden and outpoliticking the Sejm, in both things he was ultimately only moderate successfull.
The Hohenzoller were not forced to use the title "King in Prussia". They chose to. The "in" had a very specific "plausible deniability". In 1701, the Prussia you presumably know from maps didn't exist. It was divided into the Dukedom of Prussia, the eastern part, the one the Hohenzollern ruled.
And the western part, "Royal Prussia" ("Preußen Königlichen Anteils"), which the Deutsche Orden had lost in 1454 in a rebellion which promptly acknowledged the King of Poland as their liege. The following Thirteen-Years-War ended 1466 in a defeat of the order, it had to accept the loss. And what a loss it was, the order lost not only the castle of the Hochmeister, the Marienburg, but also Danzig. The newly founded West-Prussian state territory was ruled in union by the Polish King.
And that still was the reality in 1701. While the Hohenzollern ruled most of Prussia, the Polish King still was ruling in some parts of Prussia.
If Friedrich would have called himself "King of Prussia", it could have been understood as an implicit claim to those areas in "Royal Prussia", which was a thing he and his immidiate successor avoided.
His grandson (Friedrich II.), however, would later annex those areas (among others) in the first partition of Poland in 1772, and would afterwards call himself "King of Prussia".
As /u/coldsteeleyes before me, I used Iron Kingdom as source for this post.
Only to add what other already have said, since the creation of Duchy of Prussia in 1525 the real title used by dukes was "Duke in Prussia", as you can see he wasn't duke of Prussia, because the only sovereign of Prussia w King of Poland, and duke was merely a ruler of it