A job posting will usually list the Requirements and the Preferences for the position. The former must be met. The latter are used to sort candidates who meet what is required. A job posting will not list COURSES. It will list requirements and preferences in terms of background, expertise, or skills.
As an undergraduate student, you are called upon if not expected to make the match between what is required (or preferred) and the course(s) you have taken or can take at your university as well as the job experience you may already have.
Take the specific example of machine learning. What course(s) at your university has/have a description that covers this topic? When this question is not clearly answered by a catalogue description, you can visit with the department chairman or with other students in the appropriate department, in this case perhaps computer science.
Once you identify the course(s) and their prerequisites, you will have the answer to part of your ending question. The training part comes from prior experience. Again by specific example, have you done any work (other than coursework) in machine learning? Have you gotten any training outside of your university in this topic?
As for the overall question ... How can a student benefit the most ... This question has a broader scope independent of the requirements and preferences of the internship.
You can benefit the most when you learn from the internship rather than just apply (or reapply) what you already know. You can learn new concepts and principles (expand your knowledge), you can learn how to apply them to new types of problems (improve your problem-solving methods), or you can learn new ways to apply them (learn new skills).
In summary, the purpose of a job posting is for the company to solicit for candidates who meet their needs and desires. Part of the process is the expectation that you will research on your own whether you meet the requirements and whether you stand out with regard to the preferences. No one person can provide a full answer to what you need for any one given job because your current situation and your current background and experience set are unique. But, from where you are now, the basis for the research you need to do is easy. Find the courses that contain the terms used in the job description. Track back on their prerequisites. How do you fit within that list?
The next step is a job interview. Should it get that far, the purpose of a job interview is for YOU to determine whether the demands of the job will meet your needs and desires. That is where you will have to prepare the answer to your overall question FIRST before you do the job interview.