I believe that in the "old days", midshipmen were considered as an officer. Today, I don't know how it works with midshipmen, but here is how it worked in the Air Force.
The day I graduated from Air Force basic training, I was assigned to Officer Training School (OTS). At that time, Officer Trainee's were paid at the rate of the enlisted pay grade of an E-5 with the appropriate years of service. (Dispite the pay grade, Officer Trainee's were considered to be somewhere between an Airman Basic and an Airman Third Class.)
After the obligatory parade and ceremonies on commissioning day, I received a rather thick packet. In it was my commission, a set of orders formally promoting me to the rank of E-5 and an honorable discharge with the rank of E-5.
The effective date of my promotion to E-5 was the date of my appointment to OTS. (The orders contained a disclimer of sorts that said to effect that the necessity of the service prevented the publishing of the orders earlier. This was because if anyone washed out, they could be deleted from the orders.) The effective date of the honorable discharge was the date of my commission.
So, there is no pay grade as such but the service got around this in a very neat and tidy way with promotions and discharges.
And, in my experience, there were many enlisted men that were far more gentlemanly than a number officers I can recall.