https://www.uscis.gov/working-in-the-united-states/temporary...
Changing or Leaving Your H-1B Employer
Q. What is “porting”?
A. There are two kinds of job portability, or “porting,” available based on two different kinds of employer petitions:
H-1B petition portability: Eligible H-1B nonimmigrants may begin working for a new employer as soon as the employer properly files a new H-1B petition (Form I-129) requesting to amend or extend H-1B status with USCIS, without waiting for the petition to be approved. More information about H-1B portability can be found on our H-1B Specialty Occupations page.
...
Q. How do I leave my current employer to start working for a new employer while remaining in H-1B status?
A. Under H-1B portability provisions, you may begin working for a new employer as soon as they properly file a non-frivolous H-1B petition on your behalf, or as of the requested start date on the petition, whichever is later. You are not required to wait for the new employer’s H-1B petition to be approved before beginning to work for the new employer, assuming certain conditions are met. For more details about H-1B portability, see our H-1B Specialty Occupations page, under “Changing Employers or Employment Terms with the Same Employer (Portability).”
The company would still need to file an H-1B petition. It's that there is no lottery guesswork since the potential employee is already approved to work within the United States.https://www.uscis.gov/working-in-the-united-states/h-1b-spec...
When can I begin working for a new H-1B employer if I change employers?
If you are changing H-1B employers, you may begin working for the new employer as soon as they properly file a non-frivolous Form I-129 petition on your behalf, or as of the requested start date on that petition, whichever is later.
To be eligible for portability, you must not have been employed without authorization from the time of your last admission into the United States, and your new employer must properly file a new, non-frivolous petition before your H-1B period of authorized stay expires.