Note that I am not licensed to practice in your state.
You're speaking about your state's medicaid rules, which differ somewhat from state to state even though it's a federal program. Generally, medicaid has a 5 year look back period so if your mother sells you the home and within 5 years she needs to go into a nursing home, they will look at the sale. It all depends on your particular circumstance if she'll be placed in a waiting period or if she will be required to spend down assets if she's over the limit.
You really need to speak with a good medicaid planner and estate planner to plan the whole situation. Estate and medicaid planning is a very complex field that if you try to do it yourself, you might make many mistakes.
You are correct, there is a 5 year look back period for "gifts" made prior to application for Medicaid. With regard to the transfer of your mother's house, she would be making a gift to you of the value of the house that exceeded the amount you pay her for it. For example, if the house is worth $200,000 and you buy it for $100,000 your mother will be making a gift to you of $100,000.
It would be appropriate for you to have a certified appraisal of the property to establish value. That will give you some perspective on the gift vs. purchase issue. It is also likely that the Department of Public Welfare in PA will ask to see a certified appraisal for their own review purposes if the property is transferred to a related person within the five years predeeding application for Medicaid.
There are many planning opportunities that for protecting some or all of the value of real estate and other assets in a circumstance similar to the one you have described. I stongly suggest that you meet with an experienced elder law attorney to discuss all of the particulars of your case so that you can be sure that all issues are properly covered. It will be well worth it to make sure that you are doing all that you can do and also doing it properly.