If the question is:
Can a professor hire (for-money) a student at their own university to do work for their research project? Do they have to give them authorial credit?
Yes to the first question. And depending on the situation -- No -- to the second.
Professors can and hire students to work on various parts of projects. If you're a student, you should be paid (unless you're already on a fellowship being paid through that grant).
Whether you receive authorial credit depends on the work being done. I would not feel a great deal of necessity to give authorial credit the student who converted my reference style to the journal's requirements or who re-ran the statistical analysis to make sure my numbers were correct --- as long as I paid them adequately and they were operating under my direct supervision and specification.
Finally, whether you receive credit is also determined to some degree on the disciplinary standards and/or the journal that is publishing the research. Some faculty in some disciplines seemingly give credit to everyone on their team -- even the bottlewashers. Other faculty only credit the named PIs and co-PIs.
Note that you could ask that even though you do not need authorial credit, you would appreciate it if the professor included a note in the acknowledgements. This, however, might be seen by many faculty as being too forward as you are essentially asking to be thanked publicly when might have already be planning to do so.
Note: If you are a foreign student, you should check with your foreign student's office because in the USA, you are limited to 20-hours of remunerative work while under a F1 visa.