How is this possible?

Alright so I was in a relationship with someone for 2 years we would’ve made 3 this year but we broke up cause of college. To summarize it I was blinded by love. I did so much for him, ik no one asked me to do these things but I have a good heart and loved making him happy, and trust me he treated me good but... I recently found out he only loved me as a friend. I just found out that from the start he never liked me and he actually liked my guy friend. For starters i knew he was bi cause he told me a while back before we dated we were all friends. 10th grade starts and he actually starts flirting with me which makes no sense, he kept telling me “oh I know who likes you” he’d flirted with me so I thought it was him so then that escalated and he asked me out. Now my friend just told me tonight that he told her it was a mistake and he didn’t wanna hurt my feelings so he just went along with it cause in reality he was trying to tell me he had a crush on my guy friend WHAT?! I wasted 2 years on him and it all could’ve been avoided. All those memories me and him made he told me he loved me, he told me all these things how can someone be so sly and lie about it for 2 years straight. I cried so much when we broke up cause he was my best friend and I trusted him so much. He was my biggest support system and I love him for that I’ll cherish that but man he really got me fucked up. My friend who told me actually used to date the guy my ex liked and when that happened apparently he hated seeing them together. He then one night told my guy friend he was in love with him while we were dating. My friends didn’t end up working out and since that happened my ex would make fun of them. At one point my friend got fed up and stormed into his place to call him out. She then said she would tell me and for him to stop making fun of her. He obviously didn’t want that to happen so she said he’d give him the end of summer before they left to college or else she’d tell me. Now all that was happening AND I HAD NO CLUE. He would still kiss me like normal, call me baby, wtf how can someone lie like that. We finally break up two days before he left. It was a mutual break up which I liked, cried so much but now I’m finally over it. Today now OOF when I learned that gave me even more reason to get over it. He ghosted me, he’s out my life, he’ll be back for online classes for college, along with all my friends. I obviously really hate him for this but part of me can forgive him cause Ik he’s been through a lot and hs everyone is figuring themself out which I can 100% respect. But all those times we were together, me sending pics to him and in the end he lied to me and said he was attracted when in reality he wasn’t sexually attracted to me! Why lie for that long. I get he didn’t wanna hurt me but wow how can someone smile at you say they love you and do all this.