The Biblical view of Mary seems to be that she was a believer who sometimes sinned. Like John the Baptist, Peter, and other New Testament figures, she's sometimes an example of faithfulness to God and sometimes an example of how "we all stumble in many ways" (James 3:2). The belief that Mary was a sinner apparently goes back to scripture itself, and it was the prevailing view of the ante-Nicene era. The concept that Mary was sinless for some lengthy portion of her life seems to first arise among patristic sources sometime in the fourth century, but it's accompanied by references to Mary's being a sinner at other times in her life and the continuance of the older view that she was a sinner like anybody else. Below are some examples of relevant comments made by sources of the New Testament and ante-Nicene eras.
A common objection to some of these passages is that Mary may be thought of as having committed some sort of non-sinful error. Sometimes it's suggested that the writer in question may have been referring to having the power to avoid sin within ourselves, so that Mary would be exempted from the category of sinlessness only because she relied on God's power to avoid sin, not because she had committed any sin. Or it will be suggested that since angels don't sin, yet the passages about everybody sinning don't mention an exemption for angels, then perhaps Mary was being exempted without any mention as well. Such arguments have to be evaluated on a case-by-case basis. Since none of the earliest sources refer to Mary as sinless, is it likely that the early sources would repeatedly make comments such as the ones below while having an exemption for Mary in mind? Does the context of these passages suggest that the author is addressing the avoidance of sin by our own power? Or does it suggest that avoidance of sin in general, regardless of the source of the power involved, is in view? Does the context suggest that a category such as angels is being included, or is it more likely that only humans are being addressed, so that no exemption for angels would be needed? While some of these passages, below, aren't explicit, I do believe that the general thrust of the evidence is that Mary was viewed as a sinner by the earliest generations of Christianity.
I should also note that the passages discussed below are representative examples. Other relevant passages from the New Testament and the ante-Nicene sources could be cited.
In the gospels, Mary is often associated with Jesus' unbelieving brothers, not just in terms of being with them, but also in terms of joining them in their opposition to Jesus:
"Not only the religious leaders ([Matthew] 12:24, 38), but Jesus' own family doubted him (Mk 3:21-31, bracketing the Pharisees' attack; cf. Jn 7:5)....Relatives normally sought to conceal other relatives' behavior that would shame the whole family, hence their concern in Mark 3:20-21 (cf. Malina 1993: 80). Their opposition to or disbelief in Jesus is less clear in Matthew than in Mark, perhaps because of the shame of the family's unbelief, especially after Mary's experiences in Matthew's infancy narratives" (Craig Keener, A Commentary On The Gospel Of Matthew [Grand Rapids, Michigan: William B. Eerdmans Publishing Company, 1999], pp. 369-370)
A group of some of the leading Catholic and Lutheran scholars in the world, while addressing Luke 2:48-50, commented that "Mary's complaining question in v. 48 seems to be a reproach to Jesus" (Raymond Brown, et al., editors, Mary In The New Testament [Mahwah: Paulist Press, 1978], p. 160). Darrell Bock writes:
"Mary, speaking for both parents, wants to know why he [Jesus] has done such a seemingly insensitive thing. Jesus' reply in the next verse addresses both of them as well. The form of Mary's question may have OT roots (Gen. 20:9; 12:18; 26:10; Exod. 14:11; Num. 23:11; Judg. 15:11). This is the language of complaint....Bovon 1989: 159 notes that the idiom suggests the questioner's [Mary's] belief that an error has been made." (Luke, Volume 1, 1:1-9:50 [Grand Rapids, Michigan: Baker Books, 1994], p. 268 and n. 18 on p. 268)
Regarding John 2:4, Craig Keener writes:
"Jesus' answer in v. 4 is a rebuff, but like the rebuff of 4:48, is more a complaint than an assertion that he will not act....Jesus is establishing a degree of distance between himself and his mother, as did the Jesus of the Synoptic tradition....The rebuff element is increased in Jesus' next words ['What is there between us?'], however. In both OT and Gospel tradition (e.g., Mark 1:24; Luke 4:34), as well as Greco-Roman idiom, a phrase like 'What is there between us?' would imply distancing or hostility....But the primary reason for the rebuff must be that his mother does not understand what this sign will cost Jesus: it starts him on the road to his hour, the cross." (The Gospel Of John: A Commentary, Vol. 1 [Peabody, Massachusetts: Hendrickson Publishers, 2003], pp. 504-506)
Justin Martyr refers to Jesus as the only sinless person, and he denies that a Jewish opponent he was debating, Trypho, could cite a single other person who obeyed all of God's commandments:
"[Jesus is] the only blameless and righteous Man...the only blameless and righteous Light sent by God...Now, we know that He did not go to the river because He stood in need of baptism, or of the descent of the Spirit like a dove; even as He submitted to be born and to be crucified, not because He needed such things, but because of the human race, which from Adam had fallen under the power of death and the guile of the serpent, and each one of which had committed personal transgression....For the whole human race will be found to be under a curse. For it is written in the law of Moses, 'Cursed is every one that continueth not in all things that are written in the book of the law to do them.' And no one has accurately done all, nor will you [Trypho, an adherent of Judaism] venture to deny this; but some more and some less than others have observed the ordinances enjoined. But if those who are under this law appear to be under a curse for not having observed all the requirements, how much more shall all the nations appear to be under a curse who practise idolatry, who seduce youths, and commit other crimes? If, then, the Father of all wished His Christ for the whole human family to take upon Him the curses of all, knowing that, after He had been crucified and was dead, He would raise Him up, why do you argue about Him, who submitted to suffer these things according to the Father's will, as if He were accursed, and do not rather bewail yourselves?" (Dialogue With Trypho, 17, 88, 95)
"And who else is perfectly righteous, but the Son of God, who makes righteous and perfects them that believe on Him, who like unto Him are persecuted and put to death?" (Irenaeus, Demonstration Of The Apostolic Preaching, 72)
"Now, O you, my children, our Instructor is like His Father God, whose son He is, sinless, blameless, and with a soul devoid of passion; God in the form of man, stainless, the minister of His Father's will, the Word who is God, who is in the Father, who is at the Father's right hand, and with the form of God is God. He is to us a spotless image; to Him we are to try with all our might to assimilate our souls. He is wholly free from human passions; wherefore also He alone is judge, because He alone is sinless. As far, however, as we can, let us try to sin as little as possible. For nothing is so urgent in the first place as deliverance from passions and disorders, and then the checking of our liability to fall into sins that have become habitual. It is best, therefore, not to sin at all in any way, which we assert to be the prerogative of God alone...But He welcomes the repentance of the sinner - loving repentance -which follows sins. For this Word of whom we speak alone is sinless. For to sin is natural and common to all." (Clement of Alexandria, The Instructor, 1:2, 3:12)
"But there is some ground for thinking that Christ's answer denies His mother and brethren for the present, as even Apelles might learn. 'The Lord's brethren had not yet believed in Him.' So is it contained in the Gospel which was published before Marcion's time; whilst there is at the same time a want of evidence of His mother's adherence to Him, although the Marthas and the other Marys were in constant attendance on Him. In this very passage [Matthew 12:46-50] indeed, their unbelief is evident. Jesus was teaching the way of life, preaching the kingdom of God and actively engaged in healing infirmities of body and soul; but all the while, whilst strangers were intent on Him, His very nearest relatives were absent. By and by they turn up, and keep outside; but they do not go in, because, forsooth, they set small store on that which was doing within; nor do they even wait, as if they had something which they could contribute more necessary than that which He was so earnestly doing; but they prefer to interrupt Him, and wish to call Him away from His great work. Now, I ask you, Apelles, or will you Marcion, please to tell me, if you happened to be at a stage play, or had laid a wager on a foot race or a chariot race, and were called away by such a message, would you not have exclaimed, 'What are mother and brothers to me?' And did not Christ, whilst preaching and manifesting God, fulfilling the law and the prophets, and scattering the darkness of the long preceding age, justly employ this same form of words, in order to strike the unbelief of those who stood outside, or to shake off the importunity of those who would call Him away from His work? If, however, He had meant to deny His own nativity, He would have found place, time, and means for expressing Himself very differently, and not in words which might be uttered by one who had both a mother and brothers. When denying one's parents in indignation, one does not deny their existence, but censures their faults. Besides, He gave Others the preference; and since He shows their title to this favour--even because they listened to the word of God--He points out in what sense He denied His mother and His brethren. For in whatever sense He adopted as His own those who adhered to Him, in that did He deny as His those who kept aloof from Him. Christ also is wont to do to the utmost that which He enjoins on others. How strange, then, would it certainly have been, if, while he was teaching others not to esteem mother, or father, or brothers, as highly as the word of God, He were Himself to leave the word of God as soon as His mother and brethren were announced to Him! He denied His parents, then, in the sense in which He has taught us to deny ours--for God's work. But there is also another view of the case: in the abjured mother there is a figure of the synagogue, as well as of the Jews in the unbelieving brethren. In their person Israel remained outside, whilst the new disciples who kept close to Christ within, hearing and believing, represented the Church, which He called mother in a preferable sense and a worthier brotherhood, with the repudiation of the carnal relationship. It was in just the same sense, indeed, that He also replied to that exclamation of a certain woman, not denying His mother's 'womb and paps,' but designating those as more 'blessed who hear the word of God.' [Luke 11:28]" (Tertullian, On The Flesh Of Christ, 7)
"Origen insisted that, like all human beings, she [Mary] needed redemption from her sins; in particular, he interpreted Simeon's prophecy (Luke 2, 35) that a sword would pierce her soul as confirming that she had been invaded with doubts when she saw her Son crucified." (J.N.D. Kelly, Early Christian Doctrines [San Francisco, California: HarperCollins Publishers, 1978], p. 493)
"He [Jesus] alone did no sin at all" (A Treatise On Re-Baptism By An Anonymous Writer, 17)