I hate to say it, but... it sorta depends. There has to be a certain level of synergy when it comes to RPGs. Characters, story, gameplay, visuals, etc
Trails of the Sky, Tales of Zestiria, Secret of Mana remake, and various 3DS JRPGs, all games that had equal quality of great/mediocre characters and story in their respective games, but had other features (gameplay, visuals, VA'ing) that just made me not want to play despite great characters/story or made me want to keep playing despite mediocre characters/story.
But these examples don't REALLY answer your question. I had to think for a minute of an RPG that excelled at either story or characters and suffered at the other. And it hit me - FINAL FANTASY 13! I pretty much hated all the playable characters (except Fang, and in retrospect I no longer hate Sazh. I think just his VA got on my nerves...all of them did. So whiny, melodramatic, or campy. Except Fang!), but felt the story was so interesting and intriguing, I kept playing. This is an example where the story saves a game that has uninteresting or unlikable main characters for me.
I'm not sure I can think of the converse...an RPG w/ a bland or uninteresting story w/ great characters... Maybe a lot of BioWare games? Their side quests were always way more interesting than the main stories, imo. Not all, but a lot... I think maybe KotOR, DA1, and DA:I had really good main stories. But DA:O and the ME trilogy I think all had better side quests. All the aforementioned games had really great characters. Makes me realize I still gotta play Jade Empire.
Anyway, as for purchasing decisions...i guess I wouldn't care if I heard a game had just either bad characters or a bad story. I'd still play it to see if the gameplay makes up for it. Buuuuut...I guess if you want an answer, I'd choose a good story over good characters. I love both, but the story always resonates w/ me more than characters. Outside of RPGs, I can think of plenty of games that had no main/major characters I liked, but absolutely loved experiencing the story and storytelling (The Last of Us, some Silent Hills, Assassin's Creed 2).