She is but isn’t her mom...

So my best friends older sister had a baby in high school. She only cared for her for the first month until the “new” wore off. My best friend has been raising her while going to college at the same time because her sister up an left her child when she was 1 month old and moved to a city 2.5 hrs away, doesn’t have her own place and is involved in drugs. My friend is going to college, has her own place, job and provides for the child. She pops in every once in a while but only to get money from my friend and if she ( the sister) doesn’t get her way she runs off with the baby. The little girl is 2 now. She is terrified of her bio mom and calls my best friend “momma”. My friend has tried to correct her but she still calls her momma anyway. But who could blame her? She’s the only mom she’s ever known. The sister gets mad and flips out on my friend when it’s not my friends fault. How could she go about getting custody of the little girl?