ANSWER: First, let us do a brief synopsis of Samson's life before delving into whether his superhuman strength came from his hair or not. His parents were initially childless due to his mother's barrenness (Judges 13:2). God healed her for the express purpose that she bare a son to begin to free the Israelites from Philistine domination (verses 1, 5). Interestingly, not only was she commanded to raise the child as a Nazarite (verses 5, 7), she was also instructed on what food and drink to avoid during her pregnancy (verses 4, 7, 14). One of the major requirements of those, like Samson, under a Nazarite vow was that they not cut any hair on their head.
God blessed Samson as he was growing up and taking his vow seriously by leaving his hair uncut (Judges 13:24 - 25). As a man, He used his unusual strength to wage a one-man war against the tyranny of the Philistines. He also served twenty years as one of Israel's Judges (1085 to 1065 B.C.).
We now come to the well-known incident referred to in your question. The Philistines, who were frustrated and angered that they were unable to counteract Samson's strength, decide to utilize the services of a harlot named Delilah. Five Philistine leaders agree to pay her a hefty sum of money to find out how they could take down this mighty warrior (Judges 16:5). Ultimately, Delilah uses his weakness for women to discover how to render him powerless.
17. And he told her (Delilah) all his heart, and said to her, "A razor has not come upon my hair, for I am a Nazarite to God from my mother's womb. If I am shaven, then my strength will go from me, and I will become weak and be like any man"
19. And she (Delilah) made him sleep upon her knees. And she called for a man, and she caused him to shave off the seven locks of his head . . . (Judges 16:17, 19, HBFV)
After Delilah arranged for Samson to receive the only haircut he would ever have, he became as weak as other men were. While it certainly seems that he got his strength strictly from his hair, further study reveals this is not the case.
The REAL source of power
With his locks gone, the Philistines quickly rushed in to seize Samson. When he woke, he assumed he could, as he had done so many times in the past, use his power to save himself. He did not know, however, "that the Lord had departed from him" (Judges 16:20). He was immediately seized, tortured, and made a prisoner (Judges 16:20 - 21). The clear scriptural indication is that it was God's presence that gave him his miraculous abilities.
If we assume the uncut hair of a Nazarite, of itself, provides miraculous physical prowess, we then should expect others under the same criteria to have the same abilities. The Bible, however, does not support this assumption. Both Samuel the prophet and John the Baptist were Nazarites, from birth, just like Samson (1Samuel 1:11, Luke 1:15). There exists no record of either man performing a feat of superhuman strength. In fact, Scripture does not record a single miracle of ANY sort (healing the sick, raising the dead, etc.) performed by John the Baptist!
Samson's hair begins to grow back after he is taken prisoner by the Philistines (Judges 16:22). He also begins to repent of what he had done. While resting after being forced to entertain a large group of Philistines celebrating their victory over him, he utters what would become his last words.
28. And Samson called to the Lord and said, "O, Lord God, remember me, I pray You, AND STRENGTHEN ME, I pray You, only this once, O God, so that I may be at once avenged of the Philistines for my two eyes" (Judges 16:28)
This prayer would not be necessary if his hair, which had grown back, was of itself the source of his strength. Samson understood that his physical power came from the God he served and therefore asked him directly for one last chance to use it to fulfill his will. Gill's Exposition of the Entire Bible states the following regarding this prayer.
". . . and it was a prayer of faith, as appears by its being heard, accepted, and answered; and shows that his strength did not come with his hair, but was owing to the immediate communication of it from the Lord"
In closing, Samson was not born with some genetic defect or mutation that gave his hair the ability to impart superhuman strength. He was consecrated to God's service, from birth, through the Nazarite vow. When he sinned and broke the holy vow (Numbers 6:5), he cut himself off from the TRUE source of his power. It was only after pain, suffering and humiliation that he came to his senses, repented, and asked, for his final earthly act, that his gift be restored to him. His sincere prayer was honored and he died performing the job he was born to fulfill.